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

    Erwin

    12/10/2021, 9:03 AM
    Yeah I think @User was looking into it already. It is probably something up in the way that the next() function is implemented I would wager.
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 9:11 AM
    Yes, sorry, I introduced that bug a couple of days ago
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 9:11 AM
    Working on a fix today
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 9:13 AM
    No webpack with the functions directory stuff, but you’re free to build your own worker and put it in the build output directory _worker.js.
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 9:13 AM
    So you could DIY it with webpack if you need.
  • g

    geelen

    12/10/2021, 9:52 AM
    I'd like for Pages Functions Compiler to basically have a lot of the Node shims available transparently but I haven't looked into what Stripe needs in particular. Would be great if it (and lots of others) "just worked" without config, but that'll be an ongoing effort so might be best to get up to speed with generating
    _worker.js
    yourself
  • a

    albert

    12/10/2021, 12:19 PM
    Thanks! Could you post an update once it's fixed? 🙂
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 12:29 PM
    Fix is written. Will try get a release out today
  • o

    oliverjam

    12/10/2021, 1:08 PM
    Does Wrangler2 support setting
    compatibility_flags
    for Functions? I would quite like to use
    formdata_parser_supports_files
    for proper file uploads, but as far as I can tell the only way to set it is with a
    wrangler.toml
    , which appears to have no effect on
    wrangler pages dev
  • w

    Walshy | Pages

    12/10/2021, 1:09 PM
    That's default now 🙂
  • w

    Walshy | Pages

    12/10/2021, 1:10 PM
    But Miniflare (what wrangler 2 uses) will generally just support the flags out of the box from what I know
  • o

    oliverjam

    12/10/2021, 1:10 PM
    Oh weird, I'm definitely just getting strings for my multipart/formdata uploaded files. Should I not be seeing a File object?
  • w

    Walshy | Pages

    12/10/2021, 1:10 PM
    You should... I'm not sure what the compatibility date will be set as actually
  • o

    oliverjam

    12/10/2021, 1:10 PM
    (I'm literally trying to use the code from your blog post on this 😅)
  • w

    Walshy | Pages

    12/10/2021, 1:11 PM
    If Greg is around he can answer that.
  • w

    Walshy | Pages

    12/10/2021, 1:11 PM
    Haha yeah I need to update the post to say it's default and maybe add functions code
  • o

    oliverjam

    12/10/2021, 1:12 PM
    Looks like Wrangler2 defaults to the current date as the compat date (https://github.com/cloudflare/wrangler2/blob/11e230ff6b6a1674f697380ca8291ddec9dfc2a3/packages/wrangler/src/index.tsx#L193), so no idea why it's not working then
  • w

    Walshy | Pages

    12/10/2021, 1:12 PM
    That's for the init command where it makes the wrangler.toml
  • w

    Walshy | Pages

    12/10/2021, 1:12 PM
    For the pages functions, I'm not sure
  • o

    oliverjam

    12/10/2021, 1:13 PM
    Ah good point :/ FWIW I also tried this with the Quick Edit on workers.dev and got the same result. Does that use an older compat date?
  • w

    Walshy | Pages

    12/10/2021, 1:13 PM
    I don't see an option in the code @User you around? On mobile so don't have a quick way to check
  • w

    Walshy | Pages

    12/10/2021, 1:14 PM
    Yes. That will default to a very old runtime date
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 1:19 PM
    Functions unfortunately defaults to the same old version at the moment. We’ll update it when we GA to that date, and will also provide a way for people to opt-in to new feature flags/compatibility date.
  • o

    oliverjam

    12/10/2021, 1:21 PM
    Ah, so there's literally no way to get the new File behaviour with Functions yet? Locally or deployed?
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 1:30 PM
    Unfortunately not at the moment.
  • o

    oliverjam

    12/10/2021, 2:20 PM
    Thanks for the speedy responses! Saves me going down a rabbit-hole with this 😅
  • g

    Greg Brimble | Cloudflare Pages

    12/10/2021, 2:22 PM
    I've personally used this polyfill, which might help you out in the meantime: https://github.com/ssttevee/js-cfw-formdata-polyfill#readme
  • r

    remotesynth

    12/10/2021, 3:18 PM
    Hey all - Anyone know if there is a way to have a webpack config for functions that are in the
    /functions
    folder of a Pages application? I am trying to integrate the LaunchDarkly Cloudflare Edge SDK but it requires a webpack config. Otherwise I get build errors just by including the SDK.
  • o

    oliverjam

    12/10/2021, 4:14 PM
    You can't control the Functions build right now, but you can generate your own
    functions/_worker.js
    using whatever build process you like (mentioned in a message above: https://discord.com/channels/595317990191398933/910978223968518144/918792424850083870). Docs on `_worker.js`: https://developers.cloudflare.com/pages/platform/functions#advanced-mode
  • r

    remotesynth

    12/10/2021, 5:15 PM
    Ok. That's a bit unfortunate. You lose the routing that way right?
1...383940...392Latest