Unverified Commit 4ebc32bc authored by HQidea's avatar HQidea Committed by GitHub

fix: typeof msg should compare to object (#75221)

### Fixing a bug

The code is located at
https://github.com/vercel/next.js/blob/c33eb2b6505f6717a1a1eac10e193da9d9fa1ece/packages/next/src/server/lib/start-server.ts#L429
`typeof msg` should be compared to `'object'`. Otherwise, it makes no
sense.
parent 8952a10e
...@@ -426,7 +426,12 @@ export async function startServer( ...@@ -426,7 +426,12 @@ export async function startServer(
if (process.env.NEXT_PRIVATE_WORKER && process.send) { if (process.env.NEXT_PRIVATE_WORKER && process.send) {
process.addListener('message', async (msg: any) => { process.addListener('message', async (msg: any) => {
if (msg && typeof msg && msg.nextWorkerOptions && process.send) { if (
msg &&
typeof msg === 'object' &&
msg.nextWorkerOptions &&
process.send
) {
startServerSpan = trace('start-dev-server', undefined, { startServerSpan = trace('start-dev-server', undefined, {
cpus: String(os.cpus().length), cpus: String(os.cpus().length),
platform: os.platform(), platform: os.platform(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment