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

URQL not compatible with new SvelteKit fetch polyfill #2533

Closed
Nickersoft opened this issue Jul 6, 2022 · 2 comments
Closed

URQL not compatible with new SvelteKit fetch polyfill #2533

Nickersoft opened this issue Jul 6, 2022 · 2 comments
Labels
needs more info ✋ A question or report that needs more info to be addressable

Comments

@Nickersoft
Copy link

Hey folks, from my understanding, SvelteKit has recently adopted node-fetch to use as a fetch polyfill, and with it seems to be breaking SSR rendering attempts using SvelteKit with URQL. Attempting to use the fetch polyfill in the URQL from the server now results in:

Error: [Network] Request with GET/HEAD method cannot have body.

An example of an offending load function can be found here.

urql version & exchanges:

@urql/core: 2.5.0
@urql/exchange-graphcache: 4.4.3
@urql/svelte: 2.0.2

Steps to reproduce

I've updated my urql-example repo from the last time I posted here to highlight the issue. Just run yarn dev and the issue should happen on page load.

Expected behavior

The fetch call should function the same as it would in the browser. I'm not 100% this is entirely a URQL repo, as I did some digging and saw some unexpected logic happening inside node-fetch, but seeing this is where I saw the issue first, I figured I'd rule it out with you guys before opening any other issues.

Actual behavior

Described above.

@Nickersoft Nickersoft added the bug 🐛 Oh no! A bug or unintented behaviour. label Jul 6, 2022
@JoviDeCroock
Copy link
Collaborator

I mean, this sounds like a Svelte issue we are explicitly using POST as long as you don't activate useGETMethod https://github.com/FormidableLabs/urql/blob/main/packages/core/src/internal/fetchOptions.ts#L88

@kitten kitten added needs more info ✋ A question or report that needs more info to be addressable and removed bug 🐛 Oh no! A bug or unintented behaviour. labels Jul 6, 2022
@Nickersoft
Copy link
Author

Hmm... that's what I thought. And you're right, this does look like an upstream issue: sveltejs/kit#5383 (posted 5 hours ago). Closing to follow the progress over there! Thanks for confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info ✋ A question or report that needs more info to be addressable
Projects
None yet
Development

No branches or pull requests

3 participants