diff --git a/packages/next/src/server/lib/render-server.ts b/packages/next/src/server/lib/render-server.ts index de61d912890ec..2f991639248d9 100644 --- a/packages/next/src/server/lib/render-server.ts +++ b/packages/next/src/server/lib/render-server.ts @@ -61,6 +61,16 @@ export async function initialize(opts: { if (result) { return result } + + const isRouterWorker = opts.workerType === 'router' + const isRenderWorker = opts.workerType === 'render' + if (isRouterWorker) { + process.title = 'next-router-worker' + } else if (isRenderWorker) { + const type = process.env.__NEXT_PRIVATE_RENDER_WORKER! + process.title = 'next-render-worker-' + type + } + let requestHandler: RequestHandler const server = http.createServer((req, res) => { @@ -126,8 +136,8 @@ export async function initialize(opts: { } const app = next({ ...opts, - _routerWorker: opts.workerType === 'router', - _renderWorker: opts.workerType === 'render', + _routerWorker: isRouterWorker, + _renderWorker: isRenderWorker, hostname, customServer: false, httpServer: server, diff --git a/test/development/basic/node-builtins.test.ts b/test/development/basic/node-builtins.test.ts index 7cc70318b9b85..168549f091688 100644 --- a/test/development/basic/node-builtins.test.ts +++ b/test/development/basic/node-builtins.test.ts @@ -86,7 +86,7 @@ createNextDescribe( expect(parsedData.https).toBe(true) expect(parsedData.os).toBe('\n') expect(parsedData.path).toBe('/hello/world/test.txt') - expect(parsedData.process).toInclude('node') + expect(parsedData.process).toInclude('next-render-worker-pages') expect(parsedData.querystring).toBe('a=b') expect(parsedData.stringDecoder).toBe(true) expect(parsedData.sys).toBe(true) @@ -112,7 +112,7 @@ createNextDescribe( expect(parsedData.https).toBe(true) expect(parsedData.os).toBe('\n') expect(parsedData.path).toBe('/hello/world/test.txt') - expect(parsedData.process).toInclude('node') + expect(parsedData.process).toInclude('next-render-worker-pages') expect(parsedData.querystring).toBe('a=b') expect(parsedData.stringDecoder).toBe(true) expect(parsedData.sys).toBe(true) @@ -138,7 +138,7 @@ createNextDescribe( expect(parsedData.https).toBe(true) expect(parsedData.os).toBe('\n') expect(parsedData.path).toBe('/hello/world/test.txt') - expect(parsedData.process).toInclude('node') + expect(parsedData.process).toInclude('next-render-worker-app') expect(parsedData.querystring).toBe('a=b') expect(parsedData.stringDecoder).toBe(true) expect(parsedData.sys).toBe(true) @@ -164,7 +164,7 @@ createNextDescribe( expect(parsedData.https).toBe(true) expect(parsedData.os).toBe('\n') expect(parsedData.path).toBe('/hello/world/test.txt') - expect(parsedData.process).toInclude('node') + expect(parsedData.process).toInclude('next-render-worker-app') expect(parsedData.querystring).toBe('a=b') expect(parsedData.stringDecoder).toBe(true) expect(parsedData.sys).toBe(true)