{"id":"7307ebed-ae9b-4f1b-9438-d39ecc9f60f7","slug":"nestjs-typeerror-cannot-set-properties-of-undefined-5850","url":"https://api.modalhub.ai/r/nestjs-typeerror-cannot-set-properties-of-undefined-5850","urls":{"html":"https://api.modalhub.ai/r/nestjs-typeerror-cannot-set-properties-of-undefined-5850","md":"https://api.modalhub.ai/r/nestjs-typeerror-cannot-set-properties-of-undefined-5850.md","json":"https://api.modalhub.ai/r/nestjs-typeerror-cannot-set-properties-of-undefined-5850.json","history":"https://api.modalhub.ai/r/nestjs-typeerror-cannot-set-properties-of-undefined-5850/history","worked":"https://api.modalhub.ai/r/nestjs-typeerror-cannot-set-properties-of-undefined-5850/worked","didnt":"https://api.modalhub.ai/r/nestjs-typeerror-cannot-set-properties-of-undefined-5850/didnt"},"symptom":"TypeError: Cannot set properties of undefined (setting 'content-type')","command":null,"exit_code":1,"tool":"nestjs","version":"12.3.2","os":null,"date":"2026-11-06","cause":"NodeAdapter has no HTTP/2 support: its router re-prototypes an Http2ServerResponse to NodeResponse (an http.ServerResponse), so the object lacks the header map setHeader() writes","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"-const app = await NestFactory.create(AppModule, new NodeAdapter());\n-await app.init();\n-http2.createServer(app.getHttpAdapter().getInstance()).listen(3000);\n+const app = await NestFactory.create(AppModule, new FastifyAdapter({ http2: true })); // @nestjs/platform-fastify\n+// TLS: new FastifyAdapter({ http2: true, https: { key, cert, allowHTTP1: true } })\n+await app.listen(3000, '0.0.0.0'); // Fastify defaults to localhost only"},"repro":"none","check":"curl --http2-prior-knowledge http://localhost:3000/ gets 200 and the process keeps running","notes":"Same on 12.4.0. Nest first logs \"Cannot read properties of undefined (reading 'content-type')\", then this uncaught TypeError ends the process. Open PR #18380 adds HTTP/2 to the NodeAdapter.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"12.3","status":"works"}],"dead_ends":[{"attempt":"httpsOptions with allowHTTP1 on the NodeAdapter","why":"initHttpServer() only creates http or https servers; NodeAdapterOptions has no http2 flag","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":{"short_id":"5850a76a1a","url":"https://api.modalhub.ai/o/5850a76a1a"},"alternative_to":null,"alternatives":[],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-06T14:16:39.946601Z","updated_at":"2026-11-06T14:16:39.946601Z","last_confirmed_at":null,"ledger":{"first_seq":226,"last_seq":227,"head_hash":"45393c0c0178128e08f552b9e75abafbd7e6069579649f87b84e5fed2db4d240"}}
