-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
next/link from pages to appDir url results in 404 #42513
Comments
This might be related to the fact that Although I tried to create a minimal reproduction but it works fine: https://github.com/balazsorban44/nextjs-42513 Could you narrow down the reproduction so I can easily clone/build it? Currently, it requires some API keys for Notion, but it would be beneficial to cut down everything irrelevant for the reproduction anyway. 🙏 |
The underlying reason is probably this: https://github.com/captbaritone/jordaneldredge.com/blob/master/pages/%5Bslug%5D.js#L10-L12, keep in mind that the |
Here's a branch which removes everything that's not needed (including https://github.com/captbaritone/jordaneldredge.com/tree/42513-repro To repro:
ExpectedThe page defined in ActualThe page defined in Also NoteIf you use |
Yeah it's just what I said in #42513 (comment). You'll want to change that link to a normal |
Thanks for clarifying. Is it a bug that this behavior is different in dev mode than in build mode? |
Potentially yeah, the production behavior is "correct", can't do much about this unfortunately, dev behavior always hits the dev server on navigation so might be that does navigate between pages<->app |
Currently in dev the `_devPagesManifest` includes the `/app` routes as well. However, In production, the `_buildManifest.js` does not include the `/app` routes. This causes the `/pages` router to behave differently in the two environments. This change excludes the `/app` routes from `_devPagesManifest` to make it work the same in dev/prod. Fixes vercel#42513 Fixes vercel#42532 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
next build; next start
Describe the Bug
I have a link from a page (old stye) which uses
next/link
and it points to a page defined using app dir. When I click the link in dev mode it works fine, but when I click the link usingnext build; next start
I get a 404 page. Loading the URL via a link from within the app dir pages (usingnext/navigation
's Link) works fine. Loading the URL directly (no client-side navigation) also works.Expected Behavior
Clicking the link in the legacy part of my app opens the new page.
8ff964e89c6b34adc60b63be91a3570197c26d0e
Link to reproduction
https://github.com/captbaritone/jordaneldredge.com/
To Reproduce
Check out the repo, checkout hash
8ff964e89c6b34adc60b63be91a3570197c26d0e
.Click "Notes" in the nav bar.
Expected
Notes page loads
Actual
404 page renders
The text was updated successfully, but these errors were encountered: