-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
next.359 - load fetch POST => Request with GET/HEAD method cannot have body #5383
Comments
I can confirm I'm facing the same issue (urql-graphql/urql#2533). Did a little bit of digging, and it looks like #5117 introduced this bug, as the logic behind fetch requests differs slightly between node-fetch and unidici (see here and here). I'm tempted to open an issue on unidici's side, but am not sure if there's anything SvelteKit is doing to trigger this error on its side. @Rich-Harris, any thoughts since you picked up the unidici work? |
I thought it would be easy to patch in SvelteKit, but I was wrong. I found a simple workaround for now:
If you're using Node < 16, you might try |
Thx for looking at it. test 1
Now, the all page is saying: test 2
infoMaybe it's better to wait the the Again thx, keep us posted 🙏 |
You can also try patching const external_request = new Request(requested, /** @type {RequestInit} */ (opts));
response = await options.hooks.externalFetch.call(null, external_request.url, external_request); and restart the dev server. |
That's working 👍 |
@GauBen, any idea when this fix will make it to SvelteKit? |
Unfortunately I'm not a maintainer of Svelkit nor Undici. I pinged the maintainer of Undici to incite them to release the patch to npm. Once Undici is released, you won't need an update from SvelteKit for it to work. You could use |
Well, that was fast nodejs/undici#1529 (comment) |
Great news, thx 👌 |
Describe the bug
In a
load
function of a page, doing a fetch tohttp://localhost:3000/api
will throw an error:Here is the code:
Info
I stripped down the reproduction to
http://localhost:3000/api
URL.But my use case will be to target other APIs not only locals one like '/api'
Reproduction
Here is the stackblitz: https://stackblitz.com/fork/github/jycouet/sk-359-post
(fetch issue is happening, but the log is different than locally!)
Here is the minimal repo: https://github.com/jycouet/sk-359-post
With the few step in git from
npx create
to the issue.Logs
System Info
Severity
blocking an upgrade
Additional Information
It's a blocker for our Library Houdini that was working well before
next.359
.We have an issue open here: HoudiniGraphql/houdini#374
The text was updated successfully, but these errors were encountered: