Catch All route is matching for missing _next/static files
Unanswered
Lilac posted this in #help-forum
LilacOP
Hey guys! So if I have a directory setup like this
And I have setup some Middlewear logic to handle localisation with the following matcher:
Now for some reason I keep receiving requests to non existent
But the issue is not within the requests themselves but rather that
Anyone got any idea how I can prevent the render of the page, since it's filling up the logs with
I've tried:
- throwing a 404 or a redirect to a not-found page -> Next keep trying to render the page for some reason, rather than showing a 404
- try/catching the "broken" parts -> Seemingly no effect
- wrapping the useTranslate calls with try catch to swallow the errors. -> Again no real effect
For context I'm using standalone mode and the i18n library in question is
Any help on this is highly appreciated ❤️
- app
-- [lang]
--- layout.tsx
--- page.tsx
--- (group)
---- layout.tsx
---- [...slug]
----- page.tsx
And I have setup some Middlewear logic to handle localisation with the following matcher:
export const config = {
matcher: [
'/((?!api|_next/static|robots.txt|sitemap.xml|sitemap-main.xml|sitemap-sports.xml|metrics|health-check).*)',
],
};
Now for some reason I keep receiving requests to non existent
_next/static
files, possibly due to some noisy users, since I cannot get to reproduce the error locally. But the issue is not within the requests themselves but rather that
app/[lang]/(group)/[...slug]/page.tsx
tries to render instead of showing a 404.Anyone got any idea how I can prevent the render of the page, since it's filling up the logs with
Uncaught RangeError: Incorrect locale information provided
errorsI've tried:
- throwing a 404 or a redirect to a not-found page -> Next keep trying to render the page for some reason, rather than showing a 404
- try/catching the "broken" parts -> Seemingly no effect
- wrapping the useTranslate calls with try catch to swallow the errors. -> Again no real effect
For context I'm using standalone mode and the i18n library in question is
next-translate
Any help on this is highly appreciated ❤️