Skip to content

[Bug?]: TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["X-Error"] #1709

@frenzzy

Description

@frenzzy

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

POST /_server returns 500 Internal Server Error

Expected behavior 🤔

POST /_server returns 200 OK

Steps to reproduce 🕹

Steps:

  1. Install todomvc example using npm create solid
  2. Modify src/lib/api.ts#addTodo action to include the following line:
    throw new Error('Oops! Something went wrong 😅');
  3. Open the page http://localhost:3000/ and add a todo item in UI.

Context 🔦

Console log shows an error:

[h3] [unhandled] TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["X-Error"]
    at ServerResponse.setHeader (node:_http_outgoing:702:3)

It seams we should encode error message text here: packages/start/src/runtime/server-handler.ts#setHeader(h3Event,"X-Error",error.message)

Related:

Your environment 🌎

Node: v23.5.0
SolidStart: v1.0.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions