- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33.6k
Closed
Description
Version
v22.21.0
Platform
Darwin MAC-202307007 25.0.0 Darwin Kernel Version 25.0.0: Wed Sep 17 21:35:32 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6020 arm64
Subsystem
http2
What steps will reproduce the bug?
I'm experiencing this issue through Vite 7.1.11 with HTTPS options.
vite.config.ts:
import * as fs from 'node:fs'
import { defineConfig } from 'vitest/config'
export default defineConfig({
  server: {
    https: {
        key: fs.readFileSync('./key.pem'),
        cert: fs.readFileSync('./cert.pem'),
    },
  },
})Steps:
- Generate a self-signed certificate:
- Run npx vite
- Access https://localhost:5173 in browser
Error:
    VITE v7.1.11  ready in 111 ms
    ➜  Local:   https://localhost:5173/
    ➜  Network: use --host to expose
  node:_http_server:1076
                    !!server.shouldUpgradeCallback(req);
                             ^
  TypeError: server.shouldUpgradeCallback is not a function
      at parserOnIncoming (node:_http_server:1076:28)
      at HTTPParser.parserOnHeadersComplete (node:_http_common:122:17)
  Node.js v22.21.0
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
The server should handle HTTP/1.1 Upgrade requests (like WebSocket handshake) without errors.
What do you see instead?
The server crashes immediately when the first HTTP/1.1 Upgrade request is received:
TypeError: server.shouldUpgradeCallback is not a function
    at parserOnIncoming (node:_http_server:1076:28)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:122:17)
The server terminates and the upgrade request is never processed.
Additional information
This works fine on Node.js v22.20.0 and below. The issue appeared after upgrading to v22.21.0, where PR #59824 was backported but the fix PR #59924 (which has dont-land-on-v22.x label) was not.
0tarof, TheSeg, sglenns, yyfearth, yamamoto-takumi-600 and 16 moreFroyo30 and incutonez
Metadata
Metadata
Assignees
Labels
No labels