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
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.
This solves the issue where SvelteKit's load function's fetch fails to correctly construct the absolute URL based on the relative URL provided to it. It fails because the node adapter has been purposely designed to assume it's sitting behind a HTTPS reverse-proxy so it constructs an absolute URL such as "https://localhost:3000/robots.txt` when fetching /robots.txt on the server. However, the https URL doesn't exist when running we're previewing it locally with node.
Describe the bug
My project works perfectly fine using
npm run dev
, andnpm run preview
. However on runningnpm run build
, I try to test the server usingPORT=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: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
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: