-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notFound(); not working with head.js in same folder #45385
Comments
I attempted this as well, and after adding the head.tsx I had no issue using the notFound function in the page file, that rendered the not-found ui I wanted. But using the notFound function in the head.tsx file only returned the NEXT_NOT_FOUND error. |
i'd like to investigate this issue |
I was unable to reproduce the case mentioned in the issue:
But I managed to reproduce the one mentioned by @Gawdfrey, and maybe in this case it is intentional?
Anymay, looks like head.js will be deprecated soon:
|
That is probably true! But yeah, it will be deprecated soon |
Came here to say that I am having the same issue but learned about the deprecation. I've had a couple of different issues with fetching data in the head file so that's probably a good move. |
Since If anyone else is having issues with |
Verify canary release
Provide environment information
I have a /blog/[slug]/page where i call notFound() to create a custom 404 page. But i get errors in my head.js.
As soon as i delete my head.js in /blog/[slug]/head.js the function works fine.
Am I missing something?
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Head component/file (next/head / head.js)
Link to the code that reproduces this issue
https://vscode.dev/github/Gawdfrey/next-not-found-reproduction/blob/777c646c71c63e4ee15c88bf65ec0149c6ce3d23
To Reproduce
Add a head.tsx or .js in the same folder where notFound() is fired in page.tsx
Describe the Bug
Getting NEXT_NOT_FOUND when trying to implement notFound() in my [slug]/page.tsx.
Expected Behavior
It should render the content of not-found.tsx.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: