Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch broken in SSR on Cloudflare Pages #6751

Closed
Deebster opened this issue Sep 12, 2022 · 4 comments
Closed

fetch broken in SSR on Cloudflare Pages #6751

Deebster opened this issue Sep 12, 2022 · 4 comments

Comments

@Deebster
Copy link

Deebster commented Sep 12, 2022

Describe the bug

Attempting to fetch from +page.ts fails. The original error I came across said Failed to get the 'credentials' property on 'Request': the property is not implemented.

I posted about this in the Cloudflare Discord and the finger was pointed at https://github.com/sveltejs/kit/pull/5116/files.

In the original issue it was stated "At the time this hack was added, the workers runtime didn't support the credentials header set on a request - this looks to be support now" but the Cloudflare people on the Discord don't agree with this.

I made a minimal test repo, although in this case the error is different: Failed to get the 'mode' property on 'Request': the property is not implemented.

I haven't tested this when publishing via Wrangler, but they share the same runtime so I would expect it to be broken in that case too.

Reproduction

tl;dr: Publish https://github.com/Deebster/sveltekit-broken-fetch on Cloudflare Pages.

Full steps

In Github:

In Cloudflare:

  • Go to Pages
  • Create a project > Connect to Git
  • Select repo
  • In "Build settings":
    • Set "Framework preset" to "SvelteKit"
    • Add Environment variable NODE_VERSION with value 16
  • Click "Save and Deploy"

In browser:

Logs

Error: Failed to get the 'mode' property on 'Request': the property is not implemented.
    at fetch (worker.mjs:1427:24)
    at async fetcher (worker.mjs:1414:22)
    at async load (worker.mjs:603:22)
    at async load_data (worker.mjs:1690:16)
    at async worker.mjs:2496:18

System Info

Cloudflare Pages

Severity

blocking an upgrade

Additional Information

Anyone using current version of SvelteKit cannot do fetch in SSR on Cloudflare Pages.

@Deebster
Copy link
Author

My original error had the stack trace

Error: Failed to get the 'credentials' property on 'Request': the property is not implemented.
    at fetch (worker.mjs:1588:81)
    at options.hooks.handleFetch (worker.mjs:3239:77)
    at fetcher (worker.mjs:1581:42)
    at load (worker.mjs:633:24)
    at load_data (worker.mjs:1857:39)
    at async worker.mjs:2663:18

@Conduitry
Copy link
Member

The error message you say you're able to reproduce in a minimal repro is the same as #6739. So this should either be closed in favor of that, or we need a separate repro if there really is a different bug going on.

@Deebster
Copy link
Author

@Conduitry yes, this does appear to be the same issue as #6739 (Pages/Wrangler aside). I'll see if I can get a repro of my original error - I'd got most of the way through the report before noticing.

@benmccann
Copy link
Member

Ok, I'll close this as a duplicate then to help keep track of things and would recommend you file a new issue if you're able to reproduce the other error. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants