#4662·nitro

iis-node / node-server presets can't listen on iisnode named pipe (`NITRO_UNIX_SOCKET` no longer read)

Author: kabforksCreated Sep 24, 2026Updated Sep 25, 2026
Labelsv3

Environment

Reproduction

  1. Build any app with preset: "iis-node" (or node-server), using [email protected].
  2. Start it with a named pipe in PORT, as iisnode does:
    powershell
    $env:PORT='\\.\pipe\nitro-test'; node index.js
  3. Send a request to the pipe:
    javascript
    require('node:http').request({ socketPath: '\\\\.\\pipe\\nitro-test', path: '/' }, r => console.log(r.statusCode)).end()

Expected: the server listens on the pipe and responds. Actual: the server listens on port 3000, and the request to the pipe fails.

Describe the bug

iisnode passes a named pipe path (e.g. \\.\pipe\3493665b-…) in PORT, not a port number.

The node-server runtime (dist/presets/node/runtime/node-server.mjs) only accepts a numeric port:

javascript
var _parsedPort = Number.parseInt(process.env.NITRO_PORT ?? process.env.PORT ?? "");
var port = Number.isNaN(_parsedPort) ? 3e3 : _parsedPort;
serve({ port, hostname: host, /* ... */ })

A pipe path parses to NaN, so the server silently falls back to port 3000. iisnode can't reach that port, and every request fails.

The iis-node preset (which extends node-server) still generates an index.js shim that relies on the old NITRO_UNIX_SOCKET behavior (dist/_presets.mjs, writeIISNodeFiles):

javascript
if (process.env.PORT.startsWith('\\\\')) {
  process.env.NITRO_UNIX_SOCKET = process.env.PORT
  delete process.env.PORT
}
import('./server/index.mjs');

NITRO_UNIX_SOCKET is no longer read anywhere in the node-server runtime, so the shim has no effect. The iis-node preset therefore cannot work on iisnode as shipped.

In 3.0.1-alpha.0, node-server did support this: server.listen(path ? { path } : { port, host }) with path = process.env.NITRO_UNIX_SOCKET.

Additional context

Workaround

Use the node-middleware preset and create the listener yourself:

typescript
// vite.config.ts
nitro({ preset: "node-middleware", serveStatic: true })
javascript
// run.cjs (iisnode entry, referenced from web.config)
const { createServer } = require("node:http")
const port = (process.env.PORT || "3000").trim()
const target = /^\d+$/.test(port) ? Number(port) : port
import("./server/index.mjs").then(({ middleware }) => {
  createServer(middleware).listen(target)
})

Suggested fix

Either (or both):

  • Support a non-numeric PORT, or NITRO_UNIX_SOCKET, in the node-server runtime. Pass it on as a listen path, if srvx supports that, or fall back to node:http listen(path).
  • Update the iis-node preset shim to match the current runtime behavior.

Logs

bash