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

    Keizer

    03/22/2023, 10:20 PM
    The code is super simple
  • k

    Keizer

    03/22/2023, 10:27 PM
    env.MY_BUCKET is an object at least. Strange this same code would work on normal worker but not in "Pages" as a _worker.js
  • k

    kian

    03/22/2023, 10:29 PM
    How are you bundling it together?
  • k

    Keizer

    03/22/2023, 10:29 PM
    Yes, that is how I am doing differently now
  • k

    Keizer

    03/22/2023, 10:29 PM
    Using the build script features
  • k

    Keizer

    03/22/2023, 10:30 PM
    Before it was just my JS files
  • k

    Keizer

    03/22/2023, 10:30 PM
    To adhere to clean deployments and be able to use the wrangler pages publish options
  • k

    Keizer

    03/22/2023, 10:32 PM
    Should at least be getting metadata into object1 which is doing the R2 .get()
  • k

    Keizer

    03/22/2023, 10:38 PM
    I just did a regular
    Copy code
    wrangler dev
    on the project folder and also R2 not working. Just tried to run the .get() using full```c.env``` and also returns null 🤦
  • k

    Keizer

    03/22/2023, 10:44 PM
    Ugh, trying to decide if I should just go ahead and integrate Hono into a regular cloudflare worker and set /* to that worker and not use Pages to handle JS?
  • k

    Keizer

    03/22/2023, 10:44 PM
    Should I just not use pages and serve static content using Hono through a worker?
  • k

    Keizer

    03/22/2023, 10:44 PM
    I am just using Pages really to have a static file serve for my images, CSS, client side stuffs
  • k

    Keizer

    03/22/2023, 10:45 PM
    Which doesn't really even work in
    Copy code
    wrangler pages dev
    anyways lol
  • k

    Keizer

    03/22/2023, 10:45 PM
    Pages is probably nerfing it somehow
  • k

    Keizer

    03/22/2023, 10:46 PM
    I just ran my working worker code and it loads templates from R2 and into mustache no problem. Just doesn't have hanno
  • k

    Keizer

    03/22/2023, 10:47 PM
    Guess I can go refactor that worker and see if I can get Hono in there with regular worker and D2
  • k

    Keizer

    03/22/2023, 11:20 PM
    Ok can confirm
  • k

    Keizer

    03/22/2023, 11:20 PM
    I just refactored Hono into a standard worker
  • w

    Walshy | Pages

    03/22/2023, 11:20 PM
    no...
  • k

    Keizer

    03/22/2023, 11:20 PM
    Everything is working in a regular worker lol
  • k

    Keizer

    03/22/2023, 11:21 PM
    I will just somehow connect my distinct worker to a /* path and serve static content from R2
  • k

    Keizer

    03/22/2023, 11:21 PM
    Hono+R2 without pages works as expected. Not sure how the nerfing is happening
  • k

    Keizer

    03/22/2023, 11:23 PM
    Want to use Mustache too lol but I might switch to Hono template compiler just to lower dependencies
  • d

    dvonderbey

    03/23/2023, 3:13 PM
    Hi 👋 I am currently trying to write a small function to migrate from Netlify to CloudFlare Pages. We had a contact form and I now want to have a function which leverages Turnstile before calling a Slack webhook for that. Problem is that I want to use application/json with an XHR request. My local wrangler throws the following error upon callingt the function endpoint: > Error: Unsupported content type: application/json It seems like CloudFlare Pages Post endpoints don't support this content-type? I don't see any way to influence this behaviour. Does someone know a trick for this?
  • h

    HardAtWork

    03/23/2023, 3:20 PM
    That looks like an error from a framework. Can you send a repro?
  • d

    dvonderbey

    03/23/2023, 3:38 PM
    Ok super weird but suddenly the problem went away after changing my file a little bit. Maybe some kind of hickup
  • d

    dvonderbey

    03/23/2023, 3:40 PM
    But when reading the request's body in the cloudflare function it is empty, even though my browser shows body being sent. I am sending with "Content-Type": "application/json". The "bodyUsed" is also false in the request object
  • h

    HardAtWork

    03/23/2023, 3:42 PM
    How are you reading it?
  • d

    dvonderbey

    03/23/2023, 3:45 PM
    nevermind... I was missing an await on the .json() on the request
  • d

    dvonderbey

    03/23/2023, 3:45 PM
    Thanks anyhow haha
1...361362363...392Latest