https://discord.cloudflare.com logo
Join Discord
Powered by
# functions
  • h

    HardAtWork

    04/07/2023, 8:10 AM
    And also, unless you are on Unbound, you won’t be billed for duration anyway, so it doesn’t matter that much if you waste time in the global scope
  • m

    MagneticSpark

    04/07/2023, 12:30 PM
    When deploying page functions, why can't I see them in my Workers console? I'm trying to figure out which zone my page function is hosted in, but I don't know how to check that
  • h

    HardAtWork

    04/07/2023, 12:31 PM
    Pages Functions are only visible in Pages, not in Workers
  • m

    MagneticSpark

    04/07/2023, 12:32 PM
    is it possible to configure page functions with worker settings?
  • m

    MagneticSpark

    04/07/2023, 12:33 PM
    I know the setting I want (the zone) is configurable in workers, but I couldn't find out how to set that same setting in page functions
  • h

    HardAtWork

    04/07/2023, 1:25 PM
    You can do some configuration with Functions, but you can’t override its zone
  • m

    MagneticSpark

    04/07/2023, 1:26 PM
    ah, that's too bad, I was trying to get this to work: https://community.cloudflare.com/t/worker-fetch-causes-521-error-over-https-on-port-9200/443941/3 In that case, I suppose I can try using workers directly (or perhaps adding another worker as a reverse proxy)
  • h

    HardAtWork

    04/07/2023, 1:28 PM
    Yeah, that wouldn’t work because the zone of the Worker is where it responds. If you move a Function’s zone, then it would no longer respond on pages.dev, which may break your Pages project
  • m

    MagneticSpark

    04/07/2023, 1:31 PM
    rather than disabling it entirely then maybe CF could add the pages custom domain as an alternative/extra zone
  • h

    HardAtWork

    04/07/2023, 1:33 PM
    IIRC, that still wouldn’t work, since the port override only works for same-zone requests
  • m

    MagneticSpark

    04/07/2023, 1:36 PM
    you're saying that it would work if I accessed the worker at
    my-custom-domain.com
    but fail when trying via
    worker.pages.dev
    , right? That would be ok for me, but perhaps not for general use cases I guess
  • m

    MagneticSpark

    04/07/2023, 1:52 PM
    adding a Worker with a custom domain to act as a reverse proxy between my Page Function and the service on a non-standard port worked
  • m

    MagneticSpark

    04/07/2023, 1:53 PM
    a page function making a subrequest to a worker causes me to be charged for 2 invocations, right?
  • h

    HardAtWork

    04/07/2023, 1:58 PM
    Yup
  • m

    MagneticSpark

    04/07/2023, 2:02 PM
    a bit unfortunate but I'll have to live with that
  • m

    MagneticSpark

    04/07/2023, 2:11 PM
    Introducing the proxy solved one of my problems but introduced another: How do I know the invoker of my proxy is my own service? I read that workers now have support for making mTLS requests, but I don't see this setting for page functions
  • m

    MagneticSpark

    04/07/2023, 3:47 PM
    I gave up on mTLS and just used a shared secret instead
  • h

    HardAtWork

    04/07/2023, 4:32 PM
    You can add a firewall rule
  • m

    MagneticSpark

    04/07/2023, 4:33 PM
    huh, I'll look into that. What would the rule look like at a high level? I thought firewall rules were meant for allow/denying ip blocks and stuff
  • h

    HardAtWork

    04/07/2023, 4:34 PM
    There is also one to see whether a request is coming from a Worker you own
  • m

    MagneticSpark

    04/07/2023, 4:34 PM
    oh neat, that's perfect
  • s

    sjnsnsjxne

    04/07/2023, 7:11 PM
    Is the Static Forms Pages Plugin (https://developers.cloudflare.com/pages/platform/functions/plugins/static-forms/) still in use? Generates errors on import and doesn’t exist in the GitHub repo
  • s

    Soham

    04/07/2023, 8:11 PM
    have you installed the actual function through
    npm install @cloudflare/pages-plugin-static-forms
  • m

    MagneticSpark

    04/07/2023, 10:56 PM
    Any hints as to where this setting would be? I checked WAF and didn't see anything like this. Is this achieved via the Zone Lockdown product?
  • h

    HardAtWork

    04/07/2023, 11:18 PM
  • h

    HardAtWork

    04/07/2023, 11:19 PM
    From https://developers.cloudflare.com/ruleset-engine/rules-language/fields
  • m

    MagneticSpark

    04/07/2023, 11:19 PM
    thanks, I can probably figure it out from here
  • m

    MagneticSpark

    04/07/2023, 11:36 PM
    I did not realize I could write custom expressions in the WAF dashboard, nor that there were this many other fields available, this is awesome
  • s

    sjnsnsjxne

    04/08/2023, 12:16 PM
    Yes, but I appreciate you mentioning it 🙂
  • s

    Soham

    04/08/2023, 3:00 PM
    Where are you getting the import error from, your local editor or when deploying the page
1...368369370...392Latest