[adapter-node] fetch provided by load() fails to resolve URL & emits irrelevant error
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
My project works perfectly fine using npm run dev, and npm run preview. However on running npm run build, I try to test the server using PORT=4200 node build/index.js. It appears to launch, but then on accessing the page, even via http (http://localhost:4200) it emits an error. The error:
TypeError: fetch failed
at node:internal/deps/undici/undici:13392:13
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async fetch (file:///run/media/watergate/programming/grayhaze.live/affront/build/server/index.js:4289:18) {
[cause]: [Error: 00E290EB14730000:error:0A0000C6:SSL routines:tls_get_more_records:packet length too long:ssl/record/methods/tls_common.c:662:
] {
library: 'SSL routines',
reason: 'packet length too long',
code: 'ERR_SSL_PACKET_LENGTH_TOO_LONG'
}
}
Reproduction
I isolated it down to this line of my project which notably makes use of the fetch given by sveltekit. When I remove the definition on the line above I get a richer error about it being unable to parse the URL. When filling in the full domain and path of the resource svelte's fetch gives a bit richer of an error mentioning that CORS headers are missing. Despite that, when I remove svelte's fetch again and use the full domain name with node's fetch it works outright, no problems.
Logs
No response
System Info
System:
OS: Linux 6.12 Arch Linux
CPU: (16) x64 AMD Ryzen 7 5800X3D 8-Core Processor
Memory: 20.96 GB / 31.26 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 23.4.0 - /usr/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 10.9.0 - /usr/bin/npm
pnpm: 9.14.4 - /usr/bin/pnpm
bun: 1.0.2 - /usr/bin/bun
Browsers:
Chromium: 131.0.6778.108
npmPackages:
@sveltejs/adapter-auto: ^3.0.0 => 3.3.1
@sveltejs/adapter-node: ^5.2.9 => 5.2.10
@sveltejs/kit: ^2.11.0 => 2.11.1
@sveltejs/vite-plugin-svelte: ^5.0.0 => 5.0.2
svelte: ^5.0.0 => 5.14.0
vite: ^6.0.0 => 6.0.3
Severity
serious, but I can work around it
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with adapter-node by building the reported project and running PORT=4200 node build/index.js, then request http://localhost:4200. Compare the fetch call in the linked src/routes/+layout.ts with the generated build/server/index.js and Node's direct fetch; done means the provided fetch resolves the URL without the reported SSL or URL-parsing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100