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
Adding a middleware causing router.query to be empty when rewrite happens #42463
Comments
I have the same issue with next 13.0.2. Initial render from middleware gives empty object in router.query, but if I client side navigate to the dynamic route the router.query is correctly populated. When I remove middleware.ts the page work as expected, reverting to next 12.3.2 for the time being. |
I have the same issue as well, any workaround? |
x-ref: [slack thread](https://vercel.slack.com/archives/C035J346QQL/p1668195556550659) Fixes: #42463 ## Bug - [x] Related issues linked using `fixes #number` - [x] 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)
Chrome 107.0.5304.87
How are you deploying your application? (if relevant)
Vercel, but it happens locally in dev
Describe the Bug
I have the following rewrite in
next.config.js
:When I visit
/movies/123/settings
,router.query
is{ "movieId": "123" }
, as expected.However, when I add an empty
middleware.js
file,router.query
becomes{}
.middleware.js
next 12.3.1
didn't have this issue.Expected Behavior
router.query
should be{ "movieId": "123" }
when addingmiddleware.js
.Link to reproduction
https://github.com/moroshko/next-13-rewrite-issue
To Reproduce
yarn
yarn dev
http://localhost:3000/movies/123/settings
router.query
in the console.The text was updated successfully, but these errors were encountered: