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

Error message for invalid headers could be improved #3829

Closed
benmccann opened this issue Nov 13, 2024 · 0 comments · Fixed by #3833
Closed

Error message for invalid headers could be improved #3829

benmccann opened this issue Nov 13, 2024 · 0 comments · Fixed by #3833
Labels
bug Something isn't working

Comments

@benmccann
Copy link
Contributor

Bug Description

I'm getting the error message:

TypeError: Headers contructor: init is a symbol, which cannot be converted to a DOMString.

Reproducible By

const headers = new Headers({'x-fake-header': Symbol('why is this here?')})

Expected Behavior

contructor should not be typo'd

"init is a symbol" is incorrect. It contains a symbol, but isn't one

Logs & Screenshots

TypeError: Headers contructor: init is a symbol, which cannot be converted to a DOMString.
    at webidl.errors.exception (node:internal/deps/undici/undici:3384:14)
    at webidl.converters.DOMString (node:internal/deps/undici/undici:3650:29)
    at webidl.converters.ByteString (node:internal/deps/undici/undici:3658:35)
    at Object.record<ByteString, ByteString> (node:internal/deps/undici/undici:3568:32)
    at webidl.converters.HeadersInit (node:internal/deps/undici/undici:8695:67)

Environment

Tested on Node.js v20.17.0 and v22.11.0

Additional context

Users were running into this in SvelteKit projects. I'm not quite sure how/why yet, but I think maybe connect (which is used by vite) has something like this in its headers and the headers are being copied from there

@benmccann benmccann added the bug Something isn't working label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant