18 hours ago
Symptom:
Builds consistently hang forever at the exact same point in the build log — right after next build prints the ▲ Next.js 14.2.35 version banner, before "Creating an optimized production build..." ever appears. No error is logged; the build just goes silent until Railway's own timeout eventually marks it FAILED (observed at ~40 minutes with generic error "Failed to build an image. Please check the build logs for more details.").
Deployment IDs that hung/failed this way (cache enabled):
9b123edc-875a-4025-b4af-1b6dc72e70c1
7df75837-3f82-45ce-8e31-e69535af08c2
ff2a0c7d-d48e-4639-b834-3bdc2b4f51dc (eventually FAILED after ~40 min)
e5fcbdaf-d810-489b-bae1-51d5443c1608 (same hang, reproduced again after re-enabling cache)
Workaround found:
Setting NO_CACHE=1 on the service and redeploying gets the build past the stall point every time and completes successfully in ~5-7 minutes (deployment 08e867e0-8342-4dd3-b111-7418abcad134, SUCCESS). Removing NO_CACHE and redeploying with a genuinely unrelated code change reproduced the identical hang again (e5fcbdaf), so this isn't a one-off — it looks like the persistent BuildKit cache mount for this service (s/87c7d3a3-8719-4378-9474-2a3cac7a9725-.../next/cache, node_modules/.cache, etc.) is in a stuck/corrupted state that a normal cache-hit build can't get past.
Ruled out on our side: The exact same next.config.js (including an "unrecognized key" warning that also appears in every build, cache or no cache) is present in the last successful production deploy and builds cleanly both locally and in the no-cache Railway build — so this isn't a config issue, just a stuck cache.
Anyone got any thoughts ?
1 Replies
Status changed to Awaiting Railway Response Railway • about 18 hours ago
18 hours ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • about 18 hours ago