Fetch crashes in SSR
See original GitHub issueDescribe the bug
I have /
, a page that automatically fetches the endpoint /api/categories/2
.
This completely breaks SSR fetch.
Error included in logs
Reproduction
- Use @sveltejs/kit@next (1.0.0-next.131 and 1.0.0-next.133 tested)
- Fetch an endpoint from a page from SSR
- ‘Enjoy’?
Logs
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:363:5)
at onParseError (node:internal/url:536:9)
at new URL (node:internal/url:612:5)
at new Request (file:///mnt/dev/hamza/node_modules/@sveltejs/kit/dist/install-fetch.js:1239:16)
at file:///mnt/dev/hamza/node_modules/@sveltejs/kit/dist/install-fetch.js:1448:19
at new Promise (<anonymous>)
at fetch (file:///mnt/dev/hamza/node_modules/@sveltejs/kit/dist/install-fetch.js:1446:9)
System Info
System:
OS: Linux 5.10 Arch Linux
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 6.33 GB / 15.63 GB
Container: Yes
Shell: 3.2.2 - /bin/fish
Binaries:
Node: 16.3.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/bin/yarn
npm: 7.15.1 - /usr/local/bin/npm
Browsers:
Brave Browser: 91.1.25.68
Firefox: 88.0.1
npmPackages:
@sveltejs/kit: next => 1.0.0-next.133
svelte: ^3.34.0 => 3.38.3
Severity
can work around it, it’ll just be ugly
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
DNS issues kill SvelteKit SSR process with fetch() #4775
If a fetch() DNS resolution fails the SvelteKit server-side rendering process of node-adapter crashes and dies. It is unusual for a failed fetch...
Read more >React app with Server-side rendering crashes with load
I'm using react-boilerplate (with react-router, sagas, express.js) for my React app and on top of it I've added SSR logic so that once...
Read more >SvelteKit Crash Course Tutorial #8 - Loading Data & SSR
Get access to this course on Net Ninja Pro:https://netninja.dev/p/sveltekit-tutorial Get access to more premium courses on Net Ninja ...
Read more >NextJS and React-Query - Server Side fetching of data - SSR
In this quick tutorial you'll learn how to fetch data on the server with React-Query and NextJS. This is great as the data...
Read more >What's new in Next.js 13, and what do they really do?
based on the data is no longer possible. 5. SSR/SSG/ISR with the extended fetch API. Server Side Rendering (SSR), Static Site Generation (SSG),...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve been bitten in the past by not using kit’s built in fetch within the load function. Hopefully this solves your problem as well.
Okay 😦