Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prerendered server route not found #10001

Closed
WaveLinkdev opened this issue May 21, 2023 · 1 comment
Closed

Prerendered server route not found #10001

WaveLinkdev opened this issue May 21, 2023 · 1 comment

Comments

@WaveLinkdev
Copy link

WaveLinkdev commented May 21, 2023

Describe the bug

When using fetch on a server route, that is pre-rendered (export const prerender = true), the operation fails with a message of not found. It can't be requested externally either ie. through the browser. This only occurs when using the built version.

Reproduction

https://www.sveltelab.dev/s3p4ypow5f1hy0u

Run using

npm run build
npm run preview

Logs

TypeError: fetch failed
    at fetch (file:///home/httpswwwsveltelabdev-n1l0/node_modules/undici/index.js:109:13)
    at async resolve (file://file:///home/httpswwwsveltelabdev-n1l0/.svelte-kit/output/server/index.js:2663:14)
    at async respond (file://file:///home/httpswwwsveltelabdev-n1l0/.svelte-kit/output/server/index.js:2529:22)
    at async fetch (file://file:///home/httpswwwsveltelabdev-n1l0/.svelte-kit/output/server/index.js:2291:20)
    at async Object.eval [as fetch] (file://file:///home/httpswwwsveltelabdev-n1l0/.svelte-kit/output/server/index.js:2230:12)
    at async load (file://file:///home/httpswwwsveltelabdev-n1l0/.svelte-kit/output/server/entries/pages/_page.server.js:15:15)
    at async load_server_data (file://file:///home/httpswwwsveltelabdev-n1l0/.svelte-kit/output/server/index.js:540:18)
    at async eval (file://file:///home/httpswwwsveltelabdev-n1l0/.svelte-kit/output/server/index.js:1900:18) {
  cause: HTTPParserError: Response does not match the HTTP/1.1 protocol (Content-Length can't be present with Transfer-Encoding)
      at Parser.execute (file:///home/httpswwwsveltelabdev-n1l0/node_modules/undici/lib/client.js:577:15)
      at Parser.readMore (file:///home/httpswwwsveltelabdev-n1l0/node_modules/undici/lib/client.js:518:12)
      at Socket.onSocketReadable (file:///home/httpswwwsveltelabdev-n1l0/node_modules/undici/lib/client.js:945:10)
      at EventEmitter.emit (https://httpswwwsveltelabdev-n1l0.w-corp.staticblitz.com/blitz.9c8944bc.js:35:156830)
      at emitReadable_ (https://httpswwwsveltelabdev-n1l0.w-corp.staticblitz.com/blitz.9c8944bc.js:35:729152)
      at _0xe8552e (https://httpswwwsveltelabdev-n1l0.w-corp.staticblitz.com/blitz.9c8944bc.js:44:152768)
      at https://httpswwwsveltelabdev-n1l0.w-corp.staticblitz.com/blitz.9c8944bc.js:44:152515 {
    code: 'HPE_UNEXPECTED_CONTENT_LENGTH',
    data: '{"data":"Test Data"}'
  }
}

System Info

(Github Codespace)
  System:
    OS: Linux 5.4 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (2) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
    Memory: 1.22 GB / 3.84 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 19.9.0 - ~/nvm/current/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.6.3 - ~/nvm/current/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^2.1.0 => 2.1.0 
    @sveltejs/adapter-vercel: ^2.4.3 => 2.4.3 
    @sveltejs/kit: ^1.18.0 => 1.18.0 
    svelte: ^3.59.1 => 3.59.1 
    vite: ^4.3.8 => 4.3.8

Severity

serious, but I can work around it

Additional Information

This was already an issue that was apparently resolved
#8341
#8039
#8331

Supposed to be fixed in #8453

Also discussed on the discord server.

@WaveLinkdev
Copy link
Author

Okay I'm sorry, this seems to be my fault. The error seems to be something else. Even tho we did have some issues on the discord server, this probably doesn't have anything to do with it. Although, I did have this problem, it seems to have been solved by some experimentation. Sorry for all the confusion, for stealing a pretty cool issue number and wasting your time. I love you all.

I will now close the issue, and please don't stone me to death, even tho I probably deserve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant