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

    Shyamin

    11/21/2021, 7:07 PM
    What is the correct way to locally test and develop CloudFlare Pages Function
  • s

    Shyamin

    11/21/2021, 7:09 PM
    I have the folder structure with functions directory and a single js file inside it. It's working fine on pages build. Now I need to complete the development in local instead of wait for cloudflare build to 5 mins each time to see if ky code works or noy
  • s

    Shyamin

    11/21/2021, 7:10 PM
    Please guide me how to test this
  • g

    Greg Brimble | Cloudflare Pages

    11/21/2021, 7:43 PM
    You can use the wrangler 2.0 beta to test Pages functions locally.
    Copy code
    sh
    npm install wrangler@beta
    npx wrangler pages dev --help
  • w

    wonkrattle

    11/21/2021, 9:14 PM
    The fix for the error that I was running into goes live tomorrow right?
  • w

    wonkrattle

    11/21/2021, 9:14 PM
    That was what I think you said but obviously things change
  • d

    dust

    11/21/2021, 9:50 PM
    Does running in the new wrangler support secrets for pages functions? I created a
    .env
    file since that seems like it might work but I still can't get secrets to be populated.
  • g

    Greg Brimble | Cloudflare Pages

    11/21/2021, 9:51 PM
    You need to use
    --binding
    for now, but be aware that secrets aren't available in production just yet.
  • d

    dust

    11/21/2021, 9:52 PM
    Oh. Bummer. I was trying to see how easy it would be to move some existing workers over. Guess I won't do that.
  • g

    Greg Brimble | Cloudflare Pages

    11/21/2021, 9:53 PM
    Secrets are pretty close to complete. Just a couple more things needed to get that over the line. In the meantime, you could use a KV namespace if that's not too much hassle.
  • d

    dust

    11/21/2021, 9:55 PM
    That's true. Thanks for the help!
  • n

    netnr

    11/22/2021, 1:35 AM
    Local development fetch sends a GET request normally, and an error is reported when deployed to the line Error 525 Ray ID: 6b1e6a1a3e864852 • 2021-11-22 01:34:17 UTC SSL handshake failed
  • e

    Erwin

    11/22/2021, 2:38 AM
    That is certainly interesting. Do you send a request to a
    http
    or
    https
    URL?
  • n

    netnr

    11/22/2021, 2:49 AM
    yes
  • n

    netnr

    11/22/2021, 2:50 AM
    Like api.github.com is normal, but some requests report errors
  • e

    Erwin

    11/22/2021, 3:07 AM
    Hehe.. no I mean is it
    http
    or
    https
    🙂
  • e

    Erwin

    11/22/2021, 3:07 AM
    And is the URL api.github.com or something else?
  • n

    netnr

    11/22/2021, 3:10 AM
    The error is http
  • p

    Piper | Cloudflare Waiting Room

    11/22/2021, 3:13 AM
    Is there a way to export a Durable Object class from a Pages
    _worker.js
    then bind it? Or will I have to manage deploying Durable Objects separately from Pages?
  • n

    netnr

    11/22/2021, 3:20 AM
    Oh, so to speak, only support HTTP protocol will report an error, and support HTTPS at the same time is normal
  • e

    Erwin

    11/22/2021, 3:54 AM
    Yeah, I have seen another customer query that was along the same lines, that we connect to the
    https
    version or the URL, not the
    http
    service, but someone tested it recently with a service that had only
    http
    available and no
    https
    and that worked fine.. Does the url that you get the errors on over
    http
    also have a
    https
    version available?
  • n

    netnr

    11/22/2021, 4:26 AM
    No HTTPS protocol, only HTTP
  • w

    wonkrattle

    11/22/2021, 7:08 AM
    How do you HTMLrewriter multiple elements in the same function?
  • w

    wonkrattle

    11/22/2021, 7:13 AM
    I understand how to re-write the same element with different content, but what if i want to update a div and an img
  • e

    Erwin

    11/22/2021, 7:16 AM
    Could you give a before/after example?
  • w

    wonkrattle

    11/22/2021, 7:28 AM
    So on my website https://www.chrisfnicholson.com I'd like to update a line of text and change one of the menu icons to a different image
  • w

    wonkrattle

    11/22/2021, 7:29 AM
    I wrote it up here as well, which has my code: https://stackoverflow.com/questions/70062230/use-cloudflare-htmlrewriter-to-modify-multiple-different-element-types
  • w

    wonkrattle

    11/22/2021, 7:29 AM
    @Deleted User I'm sure there's a super simple way to do it, I just couldn't find any examples in the docs
  • p

    Piper | Cloudflare Waiting Room

    11/22/2021, 7:45 AM
    Is there a way to add a secret to Pages Functions?
  • w

    wonkrattle

    11/22/2021, 7:55 AM
    My understanding is that they're working on it and it's coming soon
1...131415...392Latest