Intermittent "Not Found 404" returned on first visit after idle time (Next 15 With App Router) #82839
Unanswered
llorenspujol
asked this question in
Help
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description of the bug
On the first visit to a page after some idle time (usually 1–2 hours is enough), I sometimes receive the default Next.js 404 page, even though the page definitely exists. If I refresh the page, it loads correctly 100% of the time.
The affected path is
/[lang]/events/[slug]
(others also, but focus on this only to keep it simple). The strange part is that neither the not-found.tsx from this route nor the globalapp/global-not-found.tsx
are used when this happens; it just falls back to the built-in Next.js 404... How can this really be possible?Here is a log from one of these failures:
All inner requests return 200, but the overall response is a 404. As mentioned, this only happens after the app has been idle for 1–2 hours, and it’s easy to reproduce by visiting a direct link.
Example of a link that may return 404 on first time:
https://athletiks.io/ca/events/run-music-con-camilo-10-dagost-del-2025-3de5b3
It doesn’t happen every single time, but it happens often enough to affect real users. I initially suspected a firewall issue, but logs show that isn’t the cause... (apparently)
While not critical (since refreshing always fixes it), this significantly worsens user experience, especially because many of our clients share direct links in WhatsApp groups.
Expected behavior
It should never return 404 on a page that 100% exists and all inner requests have been successful. And in case of failure, it should use the custom not-found for that path.
Environment
ca
,es
,en
Steps to reproduce
Go to this link in production, it may fail as described. If it does not fail, try another browser agent. But should definetly fail on first visit on many users:
https://athletiks.io/ca/events/run-music-con-camilo-10-dagost-del-2025-3de5b3
Additional information
No response
Example
https://athletiks.io/ca/events/run-music-con-camilo-10-dagost-del-2025-3de5b3
Beta Was this translation helpful? Give feedback.
All reactions