You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though it will only ever run on the server, the fetch implementation that is passed to load in +page.server.js is checking for CORS, behaving as if it were called in a browser.
I assume this might be an oversight from when +page.server routes were first introduced, since obviously you'd very much want this behavior in non-server page.js load function, but it doesn't really make any sense in the new environment.
I hope I didn't overlook an issue where this was discussed already and kept for technical reasons, but even then we'd probably want this documented.
The global fetch correctly doesn't implement CORS, so one can simply use that. However it is a bit confusing getting a CORS error from a request you make on the server.
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
Even though it will only ever run on the server, the fetch implementation that is passed to load in +page.server.js is checking for CORS, behaving as if it were called in a browser.
I assume this might be an oversight from when +page.server routes were first introduced, since obviously you'd very much want this behavior in non-server page.js load function, but it doesn't really make any sense in the new environment.
I hope I didn't overlook an issue where this was discussed already and kept for technical reasons, but even then we'd probably want this documented.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-52u2qj?file=src%2Froutes%2F%2Blayout.svelte,src%2Froutes%2F%2Bpage.svelte,src%2Froutes%2F%2Bpage.server.js&terminal=dev
Logs
No response
System Info
Severity
annoyance
The global fetch correctly doesn't implement CORS, so one can simply use that. However it is a bit confusing getting a CORS error from a request you make on the server.
Additional Information
No response
The text was updated successfully, but these errors were encountered: