buildManifest 404 causing app failure
See original GitHub issueBug report
Describe the bug
A clear and concise description of what the bug is.
I have a Next.js application which uses getStaticProps
and getStaticPaths
. It is running inside a docker container with the server
target, and I am repeatedly running into a 404 error when trying to fetch the buildManifest.js
file, which causes all navigation to break. It also causes direct navigation to pages that don’t have a cached version yet to hang forever on the fallback page.
To Reproduce
You can see a hanging fallback page here: https://beta.openebooks.us/app/collection/https%3A%2F%2Fqa-circulation.openebooks.us%2FUSOEI%2Fgroups%2F406
You can see the app working, but navigation not working here (because this path was cached before the problem started): https://beta.openebooks.us/app
If the buildManifest file is cached in the browser, for example by visiting the working page and then directly navigating to the not-working page, the not-working page will render correctly, though you will now see 404s on other files, like app.json
, etc in the console.
The code producing this behavior is here https://github.com/NYPL-Simplified/circulation-patron-web
Expected behavior
The buildManifest should not 404, and SSG should not hang.
Screenshots
The buildManifest
404:
The app.json
404:
Other file 404:
System information
This is running in a docker image built on top of node:12.2.0-alpine with Next.js version ^9.5.3.
Additional Context
This doesn’t seem to be always happening. The deployment worked totally fine for some time before this began.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:24 (9 by maintainers)
Top GitHub Comments
Yes, I have like 2/3 instances behind a load balancer.
I am now using the last commit hash as build id and it seems to have solved the issue 🤞 I have deployed a couple of times already and haven’t seen it happening again - it wasn’t easy to reproduce so I’ll wait for some more deploys before celebrating.
Here’s how my
next.config.js
now looks like btw:Hi! I am having the same (similar) issue.
Not always, but often (specially straight after deploying) the app would load but
buildManifest
would 404 and the navigation would be completely broken. After refreshing a couple (or sometimes several) times, the file would be found and everything would work as expected.I am trying configuring the build id as suggested and will soon know if it solves the issue 🤞 - @kristojorg did that work for you?
In the meanwhile I am thinking, shouldn’t such error be kind of louder or somehow handled? Is there a good way to find out whether files don’t load correctly at render time maybe? 🤔
Btw I have seen there’s been talks about navigation not working in the past and I am now guessing some of those might be related to this. Eg this old issue maybe 🤔