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

fix: any response headers from SvelteKit are not passed to express on Node.js v16 runtime #166

Closed
wants to merge 1 commit into from

Conversation

co3k
Copy link
Contributor

@co3k co3k commented May 19, 2022

Summary

changed to pass headers value as an Array of headers to express.Response#writeHead(...)

Fixes: #165

@co3k co3k force-pushed the fix-response-header branch from c24f3c6 to 18ed39b Compare May 19, 2022 12:43
@jthegedus
Copy link
Owner

Are you able to debug the error?

[hosting] Rewriting /about to http://localhost:5001/demo/us-central1/sveltekit for local Function us-central1/sveltekit
i  functions: Beginning execution of "sveltekit"
>  {"severity":"INFO","message":"Initialising SvelteKit SSR Handler"}
>  {"severity":"INFO","message":"SvelteKit SSR Handler initialised!"}
>  {"severity":"INFO","message":"Requested resource: /about"}
⚠  functions: TypeError [ERR_INVALID_HTTP_TOKEN]: Header name must be a valid HTTP token ["[ 'content-type', 'text/html' ]"]
    at ServerResponse.setHeader (node:_http_outgoing:578:3)
    at ServerResponse.writeHead (node:_http_server:300:21)
    at svelteKit (/tmp/svelte-adapter-firebase-LfHV/functions/sveltekit/index.js:8671:30)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runFunction (/tmp/svelte-adapter-firebase-LfHV/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:564:9)
    at async runHTTPS (/tmp/svelte-adapter-firebase-LfHV/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:590:5)
    at async handler (/tmp/svelte-adapter-firebase-LfHV/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:510:17)

I won't be able to get to this for a few days

@Nushio
Copy link
Collaborator

Nushio commented Jun 8, 2022

Hi Kousuke!

rendered.headers ?? []

Does what you're trying to accomplish, as rendered.headers is already an array.

@jthegedus jthegedus mentioned this pull request Jun 16, 2022
@timstrucken
Copy link
Contributor

Hello to you all! :) I created a new PR (#176 ) which fixed the issue for me. When using this fix, the TypeError exception was raised just like @jthegedus already commented

@jthegedus
Copy link
Owner

fixed in #176

@jthegedus jthegedus closed this Aug 7, 2022
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

Successfully merging this pull request may close these issues.

bug: any response headers from SvelteKit are not passed to express on Node.js v16 runtime
4 participants