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

    nightshade427

    11/28/2022, 5:15 PM
    Gotcha, thanks again
  • e

    Epailes

    11/28/2022, 9:20 PM
    My Remix project doesn't work after upgrading from wrangler 2.2.2 to 2.4.4
    Copy code
    Rebuilding...
    Compiled Worker successfully.
    Would you like to help improve Wrangler by sending usage metrics to Cloudflare? (y/n)
    Done in 500ms.
    Watching Remix app in development mode...
    1 warning(s) when compiling Worker.
    Would you like to help improve Wrangler by sending usage metrics to Cloudflare? (y/n)
    The project doesn't run correctly as it's stuck at this prompt, I tried passing in the send metrics flag like below: launch script is:
    Copy code
    "scripts": {
        "build": "npm run build:css && remix build",
        "build:css": "tailwindcss -m -i ./styles/app.css -o app/styles/app.css",
        "dev:remix": "remix watch",
        "dev:wrangler": "cross-env NODE_ENV=development wrangler pages dev ./public --send_metrics=false",
        "dev:css": "tailwindcss -w -i ./styles/app.css -o app/styles/app.css",
        "dev": "npm run clean && remix build && run-p dev:*",
        "start": "cross-env NODE_ENV=production npm run dev:wrangler",
        "clean": "del-cli functions && del-cli public/build"
      },
    That gives this output:
    X [ERROR] Unknown argument: send_metrics
    Am I making a silly mistake here or does
    wrangler pages dev
    need updated to take in the
    send_metrics
    flag?
  • s

    Skye

    11/28/2022, 9:21 PM
    you just need to run any wrangler command once, answer that prompt, and it should go away
  • w

    Walshy | Pages

    11/28/2022, 9:21 PM
    yeah that send_metrics broke it for me the other day too...
  • w

    Walshy | Pages

    11/28/2022, 9:22 PM
    i meant to report that but forgot
  • w

    Walshy | Pages

    11/28/2022, 9:22 PM
    could you file an issue?
  • e

    Epailes

    11/28/2022, 9:23 PM
    Ah that's fixed it thanks!
  • e

    Epailes

    11/28/2022, 9:23 PM
    yeah I'll make one 🙂
  • e

    Epailes

    11/28/2022, 9:28 PM
    https://github.com/cloudflare/wrangler2/issues/2301
  • w

    Walshy | Pages

    11/29/2022, 5:13 PM
    @Pause Service bindings are now fixed, if you redeploy they should work 🙂
  • p

    Pause

    11/29/2022, 5:29 PM
    Thanks, confirmed working.
  • i

    IEatBeans

    11/29/2022, 6:44 PM
    If I use a function for security that’s restricting a couple pages, will cloudflare cache those pages and cause some requests to bypass the security and go straight to the page, or is it smart and won’t do that
  • h

    HardAtWork

    11/29/2022, 6:46 PM
    Cloudflare Workers(and therefore Functions) will only place things in the cache if you tell them to.
  • w

    Walshy | Pages

    11/29/2022, 6:53 PM
    ^
  • w

    Walshy | Pages

    11/29/2022, 6:53 PM
    Workers run before cache, we cannot cache in front of them
  • p

    Plotzes

    11/29/2022, 7:11 PM
    hmm i do see that cloudflare cache works like normal on paths that use middleware
  • p

    Plotzes

    11/29/2022, 7:12 PM
    wait
  • p

    Plotzes

    11/29/2022, 7:12 PM
    i'm not sure
  • i

    IEatBeans

    11/29/2022, 7:17 PM
    Alright thanks!
  • i

    IEatBeans

    11/29/2022, 7:20 PM
    Yea it is a middleware, but since they said it doesn’t cache things in front of it, would that apply to middleware?
  • i

    IEatBeans

    11/29/2022, 7:21 PM
    Since the page would be behind the middleware
  • h

    HardAtWork

    11/29/2022, 7:23 PM
    Being Middleware doesn’t implicitly cache anything. You can create caching middleware if you want, but you will still be billed for every request
  • i

    IEatBeans

    11/29/2022, 7:24 PM
    But I mean cloudflares network caches the static files on my pages site by default, right? If I put a middleware infront of a static file, will cloudflare ensure the middle are always runs, even if the request for the page is being cached on the edge?
  • i

    IEatBeans

    11/29/2022, 7:25 PM
    Ig since the origin server is also cloudflare (pages), it would run the workers at the edge as well, which would mean it always runs
  • h

    HardAtWork

    11/29/2022, 7:27 PM
    Pages static files are cached, but anything using Workers/Functions, you have to cache manually
  • h

    HardAtWork

    11/29/2022, 7:27 PM
    As in, it will run on every matched request, no matter what
  • i

    IEatBeans

    11/29/2022, 7:27 PM
    Alright, that sounds like what I want. Thanks
  • c

    calebhailey

    11/29/2022, 7:37 PM
    Anyone here had any success troubleshooting "outcome: canceled" Pages Functions invocations? I can't find an "invocation statuses" dashboard for Pages Functions; perhaps that's only available for Workers? See: https://developers.cloudflare.com/workers/platform/limits/#memory (although I suspect this documentation is outdated since I also can't find "invocation statuses" for my Workers) When I look under Pages > [project] > Functions Metrics > Preview Branch, the only errors I see are my own script errors – not CPU or memory exceeded errors.
  • c

    calebhailey

    11/29/2022, 8:20 PM
    Ah, figured it out. But my only clue was this Discourse comment (thx @Walshy | Pages !!): https://community.cloudflare.com/t/worker-on-bundled-plan-getting-frequent-1101-errors-canceled-and-exception-worker-log-entry-and-response/325466/3 I was calling a custom async function without await, so the calling Pages Function would complete OK, but the called Pages Function would be canceled when the calling function completed (i.e. didn't await).
  • m

    Max Karlsson

    11/29/2022, 10:25 PM
    I'm trying to upload a file to R2 through a pages function using Remix. The response from R2 seems to say that it worked, but when I check the bucket there are no files there. I can see that the A and B class ops counts are going up though. What could be the issue here? I'm uploading the file as a Blob
1...314315316...392Latest