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

    Isaac McFadyen | YYZ01

    03/11/2022, 1:44 AM
    Yeah, possible. Different APIs etc.
  • s

    sudo killall windows

    03/11/2022, 1:44 AM
    Can i still use request.method?
  • s

    sudo killall windows

    03/11/2022, 1:44 AM
    (even though there is a better way to do it)
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 1:45 AM
    Yeah, you should be able to. But it all comes in as one, you'll need to destructure the request from the context.
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 1:45 AM
    https://developers.cloudflare.com/pages/platform/functions/#writing-your-first-function
  • s

    sudo killall windows

    03/11/2022, 1:45 AM
    Yup I copied the boilerplate
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 1:46 AM
    👍
  • s

    sudo killall windows

    03/11/2022, 1:46 AM
    The KV api is probably different or smth
  • s

    sudo killall windows

    03/11/2022, 1:47 AM
    oh it is
  • s

    sudo killall windows

    03/11/2022, 1:47 AM
    ok
  • m

    minimusubi

    03/11/2022, 4:24 AM
    Would you be able to confirm if cloudflare is aware of this issue?
  • v

    vivekpatt_whyd

    03/11/2022, 6:42 AM
    Hi All, I am desperately looking for the answer to this? Any help is appreciated. 🙏
  • a

    arnorhs

    03/11/2022, 11:05 AM
    i'm trying to deploy a function along with a website - website works fine, but in my build command i'm copying built files into
    /functions/api/.
    but after building the route gives a 404 - this is what the outputted functions routing looks like:
    Copy code
    {
      "routes": {},
      "baseURL": "/"
    }
  • a

    arnorhs

    03/11/2022, 11:28 AM
    seems like it's fine if i skip the rollup step and just move files into there unchanged.. something to do with my code then.. problem solved
  • g

    geelen

    03/11/2022, 11:34 AM
    Rollup might have been producing CJS files? We expect any files in there to have ESM-style
    export const onRequest[Get|Post|etc..]
  • a

    arnorhs

    03/11/2022, 1:22 PM
    well my output format was esm, but it's fine.. i'll figure this out later
  • a

    Artis3n

    03/11/2022, 2:08 PM
    Ugh of course, thanks
  • a

    arnorhs

    03/11/2022, 2:56 PM
    is there a simple way to use miniflare to test/run functions from pages locally?
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 2:56 PM
    Yup, there is. Take a look at
    wrangler2
    which has Pages (and therefore Functions) support and uses
    miniflare
    internally.
  • a

    arnorhs

    03/11/2022, 2:56 PM
    ah
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 2:56 PM
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 2:57 PM
    Still in beta but there's not many bugs IMO.
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 2:57 PM
    The command you want is
    wrangler pages dev
  • a

    arnorhs

    03/11/2022, 2:57 PM
    great, thanks 👍
  • a

    arnorhs

    03/11/2022, 2:57 PM
    excellent
  • b

    Basix

    03/12/2022, 9:54 AM
    Hello! How do I see error logs of the function? My website isn't working after deployment and I can't quite figure it out.
  • b

    Basix

    03/12/2022, 9:55 AM
    Oh so it isn't available... yikes
  • a

    aneves

    03/12/2022, 2:03 PM
    Looked for it too... wasn't able to find. It exists for Workers though...
  • i

    Isaac McFadyen | YYZ01

    03/12/2022, 2:04 PM
    Yeah, it's not yet here but is planned for when Functions go GA.
  • b

    balage

    03/13/2022, 7:53 PM
    @User hi! I have a question regarding sveltekit with cloudflare workers. when I try to use the workers' runtime apis (Web Crypto for example, see in screenshot), it only works when I publish it. in my local dev server I get the error "crypto is not defined". how can I make it work in my local server?
1...929394...392Latest