Validate `handle` response
See original GitHub issueDescribe the bug
I upgraded the adapter-node and kit, and changed the hooks to reflect new syntax from https://github.com/sveltejs/kit/pull/3384 and now the server crashes when started with the exit code in log
Reproduction
https://github.com/PH4NTOMiki/sveltekit-book
Logs
file:///home/mutic/dev/sveltekit-book/node_modules/@sveltejs/kit/dist/node.js:64
res.writeHead(response.status, Object.fromEntries(response.headers));
^
TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
at Function.fromEntries (<anonymous>)
at setResponse (file:///home/mutic/dev/sveltekit-book/node_modules/@sveltejs/kit/dist/node.js:64:40)
at file:///home/mutic/dev/sveltekit-book/node_modules/@sveltejs/kit/dist/chunks/index.js:2083:8
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Node.js v17.2.0
System Info
System:
OS: Linux 5.13 Manjaro Linux
CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
Memory: 1.28 GB / 7.65 GB
Container: Yes
Shell: 5.1.12 - /bin/bash
Binaries:
Node: 17.2.0 - /usr/local/bin/node
npm: 8.1.4 - /usr/bin/npm
Browsers:
Firefox: 95.0.1
npmPackages:
@sveltejs/adapter-node: ^1.0.0-next.66 => 1.0.0-next.66
@sveltejs/kit: ^1.0.0-next.236 => 1.0.0-next.236
svelte: ^3.44.3 => 3.44.3
Severity
blocking an upgrade
Additional Information
Everything was working without any issue before update.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Response validation - Ktor
If you need to customize default validation and handle exceptions for non-2xx responses in a specific way, use handleResponseExceptionWithRequest.
Read more >How to Validate Response Status using Rest Assured?
In this article, we will discuss how to validate the HTTP response status using REST Assured. The content of the post is reflected...
Read more >Validate your HTTP-responses in Typescript - Divotion
Implementing validation forces you to handle the validation errors; More robust codebase. Downsides: You have to keep your types and validators ...
Read more >c# - How to handle validation errors from API response when ...
One option is to validate Customer within its constructor. Make it impossible to create an instance of Customer that's missing its name. Now...
Read more >Step 4. Add Validation and Error Handling
Add an operation from the Validation module to the API implementation to ensure that user input is appropriate for the API. Our API...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I met the same error, for those searching for a fix I had to change :
to :
Yeah, you are right, actually I figured out that myself a few minutes ago and fixed it with a commit https://github.com/PH4NTOMiki/sveltekit-book/commit/e673854ab7f550e7bf3ff7ab87481e9f7b2a7259 to my repo, it was leftover from the previous version, and it was in a conditional that rarely comes true(it was only when the user is logged out and tried to access the API route) and when I figured out that it errors only when I’m logged-out and I knew where to look