- Notifications
You must be signed in to change notification settings - Fork29.8k
Closed
Description
What version of Next.js are you using?
10.2.2
What version of Node.js are you using?
14.15
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
vercel
Describe the Bug
I have a dynamic route in the following format:
/path/[type]
If i visit the following paths:
/path/custom1
/path/custom2
and then call router.back() from custom2 I get the following error message:
Unhandled Runtime ErrorError: The provided `as` value (/path/custom1) is incompatible with the `href` value (/h/[type]). Read more: https://nextjs.org/docs/messages/incompatible-href-asCall StackRouter._callee$node_modules/next/dist/next-server/lib/router/router.js (1055:16)tryCatchnode_modules/regenerator-runtime/runtime.js (63:14)Generator.invoke [as _invoke]node_modules/regenerator-runtime/runtime.js (293:0)Generator.eval [as next]node_modules/regenerator-runtime/runtime.js (118:0)asyncGeneratorStepnode_modules/@babel/runtime/helpers/asyncToGenerator.js (3:0)_nextnode_modules/@babel/runtime/helpers/asyncToGenerator.js (25:0)I use my app with a basepath. It is happening only when I have a basepath. My next.config.js file is:
module.exports={basePath:"/app",future:{webpack5:true}};
Given my application has lots of dynamic routes I'm unable to upgrade from 10.0 to 10.2.
Expected Behavior
The page should be able to go back from /path/custom2 to /path/custom1
To Reproduce
I have created a codesandbox with reproducable scenario:
https://znkfe.sse.codesandbox.io/app
If the buttons are followed, it will land on the issue.
Source:https://codesandbox.io/s/nextjs-routing-issue-znkfe?file=/pages/index.js
Metadata
Metadata
Assignees
Labels
No labels