Compatability with Next.js
Resolved 💬 3 comments Opened Aug 24, 2025 by gaojude Closed Nov 27, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.23.0
Which model were you using?
gpt-5
What platform is your computer?
Darwin 25.0.0 arm64 arm
What steps can reproduce the bug?
Open Codex CLI at any Next.js project and say "build the project".
What is the expected behavior?
The script should take less than 10 seconds to complete:
> time pnpm build
...
pnpm build 0.66s user 0.19s system 12% cpu 6.574 total
What do you see instead?
Then it runs the build script from package manager, but that takes forever:
user
run bulid and fix the error from it
codex
Running pnpm build to catch errors and fix them.
⚙︎ Working • 263s
└ ⌨️ pnpm build
<img width="927" height="494" alt="Image" src="https://github.com/user-attachments/assets/c2e2c262-9f23-40ca-904e-da31a31f50ff" />
Additional information
_No response_
3 Comments
https://github.com/gaojude/dio-build-fail
When running turbopack build in Codex sandbox, we've seen it running forever, or throwing the following error:
Whereas, running it outside Codex execution would result in a proper compilation error.
A separate issue:
If you remove
--turbopackfrombuildscript.The build would fail due to the sandbox's network restriction. During build, Next.js build process needs to download fonts; preventing it from network access would result in build failure.
These commands need to get renamed, but to investigate what happens when a command runs in the sandbox provided by Codex, I would try:
Indeed, lack of network access appears to be an issue, since we see:
You can use
--dangerously-bypass-approvals-and-sandboxto disable the sandbox, but we do not currently have support for customizing the network policy for the sandbox.The other option today is to run Codex in a Docker container with
--dangerously-bypass-approvals-and-sandbox, but to use Docker's options for configuring the network policy for the container.