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

    rain

    12/13/2022, 2:49 PM
    this is so i can see what is consuming functions and change the build step to disable it
  • r

    rain

    12/13/2022, 2:50 PM
    aaah, you need to click into each project to see it and there isnt a single aggregated view
  • j

    JustinNoel

    12/13/2022, 4:17 PM
    Not that I'm aware of. I added it to #920749372256419930 https://discord.com/channels/595317990191398933/920749372256419930/1052257731660230697
  • d

    DatSparrow

    12/13/2022, 4:58 PM
    Works, thanks 🙂
  • d

    devon

    12/13/2022, 11:45 PM
    https://github.com/cloudflare/wrangler2/pull/1857#issuecomment-1247886941 I spent a lot of time migrating a worker with a router over to the functions directory following the function directory's routing patterns only to discover this very jenky suggestion for deployment with node_compat upon completing my code migration. Very disappointing - especially that this limitation isn't mentioned anywhere in the docs. Totally blocks me from utilizing page functions which I hoped would easily keep my frontend and backend code in sync via git provider connection. the wrangler. Honestly surprised this feature went into "general availability" with a total disregard for wrangler.toml config (and didn't mention that anywhere) - feels very paradigm breaking.
  • z

    zszszsz

    12/14/2022, 12:09 AM
    oh come on pages functions are super cool
  • j

    James

    12/14/2022, 12:12 AM
    They are super cool, but I think that's very valid feedback. The process for node compat in Workers is as simple as adding
    node_compat = true
    to your
    wrangler.toml
    . For a while, this worked in dev for Pages and not prod, and now it doesn't work in either. That's a pretty crummy DX and I think the Pages team is very aware of that. There's work happening for Pages config where hopefully this kind of thing can happen, but I don't think there's any real ETA on that unfortunately. So ultimately, you're left to build a
    _worker.js
    yourself if you need to do anything complex 😦
  • b

    botato

    12/14/2022, 12:16 AM
    wait, you can provide worker code in a function by using a
    _worker
    file?
  • j

    James

    12/14/2022, 12:17 AM
    Functions has an "advanced mode" where you can effectively just run a Worker, and then get assets via `env.ASSETS`: https://developers.cloudflare.com/pages/platform/functions/advanced-mode/
  • j

    James

    12/14/2022, 12:18 AM
    This will mean that every call to your site will count towards your limits though - static assets are no longer free unless you configure your `_routes.json`: https://developers.cloudflare.com/pages/platform/functions/routing/#creating-a-_routesjson-file
  • b

    botato

    12/14/2022, 12:18 AM
    unfortunate, but other than that
  • b

    botato

    12/14/2022, 12:18 AM
    that is, objectively, extremely based
  • z

    zszszsz

    12/14/2022, 12:57 AM
    But what's the benefit of using pages instead of workers then ?
  • j

    James

    12/14/2022, 12:57 AM
    CI, GitHub integration, and easy static assets
  • u

    Unsmart | Tech debt

    12/14/2022, 12:58 AM
    previews
  • u

    Unsmart | Tech debt

    12/14/2022, 12:58 AM
    biggest one imo
  • z

    zszszsz

    12/14/2022, 12:59 AM
    Hmmm, maybe CF should really apply these features to workers as well
  • j

    James

    12/14/2022, 12:59 AM
    Wouldn’t that be cool 👀
  • d

    devon

    12/14/2022, 1:44 AM
    Yup 90% of what I'm disappointed by is that this limitation isn't clearly documented and documenting it is a very simple fix.
  • d

    devon

    12/14/2022, 1:45 AM
    I totally get that the feature just isn't figured out yet.
  • c

    charles.morrow

    12/14/2022, 2:43 PM
    this ^
  • d

    DatSparrow

    12/14/2022, 2:48 PM
    I have published a sveltekit app and am having a 500 server error only on cloudflare pages, I am therefore trying to tail the cloudflare pages build with
    Copy code
    wrangler pages deployment tail --environment=preview
    and it connects to the deployment correctly. However, the tail is not showing any output when going to the page that triggers a 500 error, locally this would normally output errors via console.log - so I know that something is being logged but for some reason the pages tail isn't picking it up. Any ideas? Update: What makes this even stranger is that sometimes it works but others times it doesn't. I changed my code locally that I know works on cf pages to include a console log to see if it outputs in tail, but now the error page also logs in tail. But sometimes it doesn't. Seems if I tail the deployment before any requests are made to it, the logs show, but if I tail the deployment after even one request is made to it, the logs never show, even if I wait for a bit before tailing again. What is going on here?
  • d

    dinislam

    12/15/2022, 7:24 AM
    Anyone know how to fix this type error?
  • h

    HardAtWork

    12/15/2022, 7:28 AM
    You need the Cloudflare Response type. I recommend setting workers-types as a global type package
  • d

    dinislam

    12/15/2022, 7:29 AM
    how would that work? I assume I'll need to set something in tsconfig.json
  • h

    HardAtWork

    12/15/2022, 7:30 AM
    Should look something like this: https://raw.githubusercontent.com/mrbbot/slshx-starter/master/tsconfig.json
  • d

    dinislam

    12/15/2022, 7:31 AM
    This worked. Thank you 🙏
  • h

    HardAtWork

    12/15/2022, 7:40 AM
    No problem!
  • z

    zszszsz

    12/15/2022, 10:09 AM
    node_modules/ws/lib/sender.js:162 throw new TypeError('First argument must be a valid error code number');
  • z

    zszszsz

    12/15/2022, 10:09 AM
    Wrangler keep throwing this
1...318319320...392Latest