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 in load crashes when using method: "POST" #5401

Closed
MathiasWP opened this issue Jul 7, 2022 · 2 comments
Closed

Fetch in load crashes when using method: "POST" #5401

MathiasWP opened this issue Jul 7, 2022 · 2 comments

Comments

@MathiasWP
Copy link
Contributor

Describe the bug

Using the fetch method in load says Request with GET/HEAD method cannot have body., even though the method is a "POST" request.

If i use an external endpoint, then the whole application crashes, and if i use a local endpoint then the webpage renders but the error is thrown on the server.

I tried debugging a little bit, and it seems like svelte-kit first throws a GET request, and then afterwards the correct POST request. Note that I am not 100% sure this is the case, it's just a hypothesis after adding logs around in node/polyfills.js.

I wanted to try and solve this issue myself because this is a critical bug for our application, but i sadly don't have the time today. I will help as much as i can if anyone will help solving this issue asap.

Reproduction

https://github.com/MathiasWP/sveltekit-load-external-fetch-post-error

Logs

No response

System Info

System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 28.71 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.13.1 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 103.1.40.107
    Chrome: 103.0.5060.114
    Firefox: 100.0
    Safari: 14.1.1
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.54 
    @sveltejs/kit: 1.0.0-next.360 => 1.0.0-next.360 
    svelte: ^3.44.0 => 3.48.0 
    vite: ^2.9.13 => 2.9.13

Severity

blocking all usage of SvelteKit

Additional Information

No response

@MathiasWP MathiasWP changed the title Fetch in load crashes when using post to external resource Fetch in load crashes when using method: "POST" Jul 7, 2022
@david-plugge
Copy link
Contributor

#5383

@Conduitry
Copy link
Member

Yup, closing as duplicate of #5383.

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