On dev server, every request compiles the not-found page before loading the actual page, no 404s in logs #68288
Unanswered
televators
asked this question in
Help
Replies: 1 comment
-
I am having the same issue |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I'm a noob with Next still, and have been working through a course and some tutorials. I keep running into an issue with the dev server always running the not-found page on every request, even when there's no actual 404 happening anywhere.
The exact way it happens seems to change a little, seemingly dependent on whether my machine has been running for a while. Force clearing Node cache, removing
.next/
, removingnode_modules/
and reinstalling, and trying different browsers all do nothing to change the behavior.I'm on WSL2 (Ubuntu 22.04.4 LTS) and here're my package versions for my current project:
I've tried Node 18, 20, and 22, and Next 14.1.0, 14.2.4, and 14.2.5, with the same result. The current project is pretty close to a barebones fresh install, the previous project had lots going on.
With a fresh install via the Getting Started guide, if I just add a basic
app/not-found.jsx
with the following contents:...that console log happens on every request.
At some point, usually after my machine has been running for a while (only difference I can think of atm), I"ll start seeing this in the dev server console on every request:
Often, the console log ping will show two to four times per page load/request, and not always in the same order.
Since the last restart of my machine, I can't get the above variant to show but that's what I see after a while. Again, no 404 response in either dev server console or browser console, and whatever page I'm requesting always loads normally. This happens whether I have a custom
app/not-found.jsx
present or not; I've added one for testing since at this very moment, I'm not getting theCompiling /_not-found
log again yet, though the not-found page is indeed still running on every request.During the course I was doing, I just ignored it after a while since it wasn't causing any real issue. However, in my current project I'm using Clerk for auth and the not-found being called is triggering a bug with Clerk. I found a GH issue on the Clerk JS repo explaining that if a 404 is detected, Clerk will throw an error about middleware not being detected. Advice from the issue was to just ignore it if everything still works, which it does afaict, but my server console is so cluttered with errors that it's hard to spot actual important errors from my project code and it bugs me immensely.
Has anyone else seen this behavior before? I've tried searching so many combos of keywords via search engine as well as the vercel/nextjs GH issues and can't find anything helpful. Is it normal for the not-found page to be compiled/prerendered on every request regardless of whether a 404 has happened? That doesn't seem right to me but I'm pretty new to Next.
Additional information
No response
Example
https://github.com/televators/nextjs-404-bug-repro
Beta Was this translation helpful? Give feedback.
All reactions