question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛 BUG: SvelteKit Still Had Null Body Response Error

See original GitHub issue

What version of Wrangler are you using?

0.0.15

What operating system are you using?

Windows

Describe the Bug

SvelteKit still gets null body response error which was fixed in https://github.com/cloudflare/miniflare/releases/tag/v2.0.0-rc.3, not sure how Wrangler2 incorporates miniflare, is there a pending version update or is this a separate issue?

SETUP

npm init svelte@next my-app
npm i --save-dev @sveltejs/adapter-cloudflare@next
Update svelte.config.js to use adapter.
npm install

LAUNCH npx wrangler pages dev --proxy 3000 -- npx svelte-kit dev --host ERROR When viewing project on _http://localhost:8788/_ page will alternate between rendering correctly and showing this: image

BEHAVIOR When viewing same page with network tab open and disable cache enabled, error does not occur

Output:

[pages:err] GET /: TypeError: Response with null body status cannot have body
    at new Response (E:\Programming\Projects\ArtPageSvelteWrangler\node_modules\undici\lib\fetch\response.js:160:15)
    at new Response (E:\Programming\Projects\ArtPageSvelteWrangler\node_modules\@miniflare\core\src\standards\http.ts:556:13)
    at Object.construct (E:\Programming\Projects\ArtPageSvelteWrangler\node_modules\@miniflare\core\src\plugins\core.ts:69:29)
    at Object.fetch (<script>:5:24)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at EventTarget.[kDispatchFetch] (E:\Programming\Projects\ArtPageSvelteWrangler\node_modules\@miniflare\core\src\standards\event.ts:359:13)
    at Server.<anonymous> (E:\Programming\Projects\ArtPageSvelteWrangler\node_modules\@miniflare\http-server\src\index.ts:167:20)
GET / 500 Internal Server Error (22.61ms)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, Feb 7, 2022

We’ve found the issue. The problem is in the Miniflare proxy. @GregBrimble is working on a fix. In the meantime, you can (sort of) workaround this by building the Svelte app and then running the build output via pages directly…

npm run build
npx wrangler pages dev .svelte-kit/cloudflare
0reactions
petebacondarwincommented, Feb 7, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors • Docs • SvelteKit
If an error occurs inside handle or inside a +server.js request handler, SvelteKit will respond with either a fallback error page or a...
Read more >
How to write tests in Sveltekit and Vitest - Eternal Dev
We will learn about setting up Sveltekit and Vitest for writing tests ... component that will have the loading, success, and error states....
Read more >
Unable to access request.body from the endpoint.js in sveltekit ...
When I add const data = await request.json(), when compile using npm run dev, I get an error that request.json() is not a...
Read more >
Recommended - SlideShare
Routing At the heart of SvelteKit is a filesystem-based router. The routes of. +page.js Often, a page will need to load some data...
Read more >
General | ʻenehana – Hekili Tech
To start, i made the simple component, which would have an ... Less bloat == less bugs. ... npm init svelte nhost-sveltekit-auth-test cd ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found