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

    Isaac McFadyen | YYZ01

    03/22/2022, 1:48 PM
    https://v3.nuxtjs.org/docs/deployment/cloudflare/
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 1:48 PM
    Not sure how the setup is different though.
  • w

    warflash

    03/22/2022, 2:00 PM
    Oh thats relieving, awesome to hear. I was considering not using nuxt 3 for our upcoming project as unfortunately was unanswered. From what I know ssr on functions depends on the still private nitropack repo so they must've made more progress there than whats shown in the issue. They really need to work on their communication I guess^^ Thanks for letting me know, much appreciated 😄
  • d

    Deleted User

    03/22/2022, 3:16 PM
    you can technically set up CI for workers right
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 3:17 PM
    Yeah but it's your own. Editing to clarify though, thanks.
  • r

    rishav

    03/22/2022, 7:16 PM
    How would I go about reading the body text in my api route?
    Copy code
    > GET /api/get-post-score HTTP/1.1
    > Host: localhost:8788
    > User-Agent: insomnia/2021.7.2
    > Content-Type: application/json
    > Accept: */*
    > Content-Length: 34
    
    | {
    |     "foo": "bar",
    |     "ping": "pong"
    | }
    for me the
    request.body
    always comes as
    null
  • k

    kian

    03/22/2022, 7:17 PM
    await request.json()
    /
    await request.text()
  • k

    kian

    03/22/2022, 7:18 PM
    https://developers.cloudflare.com/workers/runtime-apis/request/#instance-methods
  • r

    rishav

    03/22/2022, 7:22 PM
    Thanks. When I tried that, I get
    [pages:err] GET /api/get-post-score: SyntaxError: Unexpected end of JSON input
    error. Not sure what am I doing wrong
  • k

    kian

    03/22/2022, 7:25 PM
    The request you posted is a
    GET
    request - which having a request body for isn't usually expected.
  • r

    rishav

    03/22/2022, 7:25 PM
    Thanks! Learned something new today!
  • s

    simpson

    03/22/2022, 9:56 PM
    is it possible to get the prod/dev env variables inside functions?
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 10:00 PM
    Yup, are you using a framework or just a vanilla Function?
  • s

    simpson

    03/22/2022, 10:01 PM
    vanilla function
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 10:01 PM
    Take a look at https://developers.cloudflare.com/pages/platform/functions/#writing-your-first-function
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 10:01 PM
    Specifically the
    env
    input.
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 10:01 PM
    You'll find your environment variables in there.
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 10:01 PM
    Oh wait.
  • i

    Isaac McFadyen | YYZ01

    03/22/2022, 10:01 PM
    Do you mean the environment variable that TELLS you whether it's prod or dev?
  • s

    simpson

    03/23/2022, 1:42 PM
    using the same env variables we use in Pages
  • s

    simpson

    03/23/2022, 1:43 PM
  • i

    Isaac McFadyen | YYZ01

    03/23/2022, 1:43 PM
    Yeah so the environment variables that are declared in the Environment Variables tab are on the` context.env` input to Functions.
  • i

    Isaac McFadyen | YYZ01

    03/23/2022, 1:44 PM
    You can destructure either by doing
    onRequest({env})
    or taking it out of
    context
    manually.
  • s

    simpson

    03/23/2022, 1:56 PM
    thanks!
  • g

    Greylock

    03/23/2022, 2:14 PM
    How do durable object bindings work with functions on Pages?
  • g

    Greylock

    03/23/2022, 2:14 PM
    the pages website does have a section that says durable objects, but since pages doesn't need a ``wrangler.toml``, where do we specify the bindings?
  • w

    Walshy | Pages

    03/23/2022, 2:16 PM
    Right in the settings tab of Pages You will currently need an external Worker to create the namespace though
  • g

    Greylock

    03/23/2022, 2:19 PM
    gotcha. Thanks 🙂
  • s

    simpson

    03/24/2022, 12:28 AM
    does anyone have a sample of rendering a simple html page of hello world with a function?
  • s

    simpson

    03/24/2022, 12:31 AM
    https://developers.cloudflare.com/workers/examples/return-html/ this fails
1...107108109...392Latest