ReferenceError: Headers is not defined
Answered
Black carp posted this in #help-forum
Black carpOP
Alright, so I'm posting here because I genuinely have no more leads to follow.
I am deploying a project with the following architectural context:
- Turborepo v2.0.3
- PNPM v9.2.0 (w/ Workspaces)
- NextJS Site v14.2.3
- Node v20.2.0
The NextJS site lives at
I can successfully build everything using
When building the NextJS site (everything else has successfully built up to this point) I get the following error stacktrace (trimmed for brevity):
It does not appear to be a common issue so I suspect I have done something in my own configs or hit a strange edge case.
Some things I have investigated, but always willing to double check and verify:
- I do not have any flags disabling built-in fetch for Node
- The build step logs
I am deploying a project with the following architectural context:
- Turborepo v2.0.3
- PNPM v9.2.0 (w/ Workspaces)
- NextJS Site v14.2.3
- Node v20.2.0
The NextJS site lives at
./apps/dotcom relative to the project root.I can successfully build everything using
turbo run build --filter="@scope/dotcom..." and it logs the correct scope for all internal deps to be pre-built as well.When building the NextJS site (everything else has successfully built up to this point) I get the following error stacktrace (trimmed for brevity):
@scope/dotcom:build: unhandledRejection ReferenceError: Headers is not defined
@scope/dotcom:build: at Object.<anonymous> (/vercel/path0/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/web/spec-extension/adapters/headers.js:32:30)
...
@scope/dotcom:build: ELIFECYCLE Command failed with exit code 1.
@scope/dotcom:build: ERROR: command finished with error: command (/vercel/path0/apps/dotcom) /pnpm9/node_modules/.bin/pnpm run build exited (1)
@scope/dotcom#build: command (/vercel/path0/apps/dotcom) /pnpm9/node_modules/.bin/pnpm run build exited (1)
Tasks: 5 successful, 6 total It does not appear to be a common issue so I suspect I have done something in my own configs or hit a strange edge case.
Some things I have investigated, but always willing to double check and verify:
- I do not have any flags disabling built-in fetch for Node
- The build step logs
v20.12.2 which is notably different to the v20.12.0 on my local. Currently looking into this.Answered by Black carp
Solved this indirectly. Still not clear on what caused the error though I can speculate.
1 Reply
Black carpOP
Solved this indirectly. Still not clear on what caused the error though I can speculate.
Answer