Unexpected 404 logs on every page refresh (middleware removed, still occurring) #84488
Replies: 2 comments
-
Is the status code in the response 200 too? Strange indeed, could you give us some more context on the issue? |
Beta Was this translation helpful? Give feedback.
-
Don't know if this is in any way relevant to your case but I've seen this error "E394" recently because of a bug in my useEffect cleanup callback. I had written my own hook that attaches event listeners to an element ref and detaches it again using an AbortController. It basically did this: useEffect(() => {
if (elementRef.current) {
const abortController = new AbortController();
elementRef.current.addEventListener(
eventName,
eventHandler as EventListenerOrEventListenerObject,
{
signal: abortController.signal,
},
);
return abortController.abort;
}
}, [elementRef, eventName]); This failed whenever a Next.js redirect caused the component that used the hook to unmount. Turns out returning return () => abortController.abort(); I assumed since the cleanup function and the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I’m running into an issue where every page refresh logs a 404 Not Found error, even though the actual page renders correctly. This happens on all routes.
What’s happening:
When I refresh a page, the application logs a 404 error.
The browser shows the correct page (not a 404 screen).
This happens consistently on all pages, not just specific routes.
What I’ve tried:
Removed my custom middleware → the error still occurs.
Attached a debugger → saw an E394 error.
Verified that the rendered page content is correct, only the logs are wrong.
Problem:
It seems like the request/response cycle is triggering a 404 internally, but then still rendering the expected page. I suspect something related to middleware ordering, client-side routing, or static assets, but I haven’t been able to pinpoint it.
Question:
Has anyone seen similar behavior, where the server logs 404s on refresh but still renders the correct page?
Could this be due to catch-all routing for a frontend framework, or a logging middleware misreporting status codes?
Any tips on how to debug the E394 error further?
Thanks in advance for any insights! 🙏
Beta Was this translation helpful? Give feedback.
All reactions