#13168·kit

[adapter-node] fetch provided by load() fails to resolve URL & emits irrelevant error

Author: hugeblankCreated Dec 16, 2024Updated Sep 10, 2026
Labelsdocumentationpkg:adapter-node

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

bash
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