Skip to content

adapter-node broken in next.153 #2239

@kamholz

Description

@kamholz

Describe the bug

I recently updated kit from next.151 to next.153 and now I am seeing an odd error when I submit a POST request to an endpoint:

node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: ERR_HTTP_INVALID_STATUS_CODE
    at new NodeError (node:internal/errors:371:5)
    at ServerResponse.writeHead (node:_http_server:275:11)
    at ServerResponse.writeHead (file://.../repo/app/build/index.js:21366:26)
    at ServerResponse._implicitHeader (node:_http_server:266:8)
    at ServerResponse.end (file://.../repo/app/build/index.js:21516:14)
    at Polka.onError (file://.../repo/app/build/index.js:21734:9)
    at next (file://.../repo/app/build/index.js:21798:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_HTTP_INVALID_STATUS_CODE'
}

This error causes the server to terminate.

Everything in this code path has worked fine for a couple months, all the way up to next.151. I've verified that the error only occurs in adapter-node, not under dev/preview. This issue renders my app unusable so I've reverted to next.151 until I can figure out what's going on. It could be something in my code but seems more likely to be an issue with adapter-node.

Reproduction

I'll work on this but wanted to report it first because this is a serious bug.

Logs

No response

System Info

System:
    OS: macOS 11.5.1
    CPU: (8) arm64 Apple M1
    Memory: 977.19 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.6.2 - /opt/homebrew/bin/node
    npm: 7.20.3 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 92.0.4515.131
    Safari: 14.1.2
  npmPackages:
    @sveltejs/adapter-node: ^1.0.0-next.42 => 1.0.0-next.42 
    @sveltejs/kit: ^1.0.0-next.153 => 1.0.0-next.153 
    svelte: ^3.41.0 => 3.41.0

Severity

blocking all usage of SvelteKit

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions