-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Validate handle
response
#3491
Comments
I'm guessing it's this line: Line 64 in 1bce8e9
|
Can you provide more details about how to reproduce this? Your repro is working fine for me |
Actually for me it works sometimes, and sometimes not, (with and without the entries() fix). |
It's like 10:4 ratio |
I added a console log to my dist/node.js file, and I'll let you know if i get something from it. |
@Rich-Harris Actually I found out what is the error, and event the log shows it, sometimes the res.writeHead(response.status, response.headers.constructor.toString().indexOf('Headers') > -1 ? Object.fromEntries(response.headers)) : response.headers; |
Something like that, I used constructor to check if it's a Headers but could be(probably there is) something better |
A better fix would be to figure out why it's sometimes getting passed an object. Can you use |
Yeah, I understand and agree with you, but it doesn't happen frequently now for me, if it happens I'll write here, but for me that's seems like a quick and easy fix for the issue, that occurs rarely. |
Are you returning a |
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 |
handle
response
I met the same error, for those searching for a fix I had to change : export const handle = async ({ event, resolve }) => {
if (condition)
return LoginPage
}
const LoginPage = {
status: 200,
headers: {
'content-type': 'text/html',
'cache-Control': 'private, max-age=0, no-cache',
},
body: '<html>...</html>',
} to : const LoginPage = () => new Response('<html>...</html>', {
status: 200,
headers: {
'content-type': 'text/html',
'cache-Control': 'private, max-age=0, no-cache',
}
}) |
Describe the bug
I upgraded the adapter-node and kit, and changed the hooks to reflect new syntax from #3384 and now the server crashes when started with the exit code in log
Reproduction
https://github.com/PH4NTOMiki/sveltekit-book
Logs
System Info
Severity
blocking an upgrade
Additional Information
Everything was working without any issue before update.
The text was updated successfully, but these errors were encountered: