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
"Unhandled Runtime Error, incompatible-href-as" when using _middleware.ts rewrites with getStaticProps + fallback true as well as when using CSR only. #32446
Comments
This comment has been minimized.
This comment has been minimized.
Facing the same issue, if we can't use middlewares rewrites this way why not specifying it in the docs ? |
Hi @moinulmoin. Have you personally found a solution ? Using fallback blocking isn't a big deal but not being able to use CSR is kinda unfortunate. |
@StitiFatah @Username2k1 Have you tried to use This might be rehydration issue which is fixed in this PR #32534 |
@albertputrapurnama Thanks for pointing to this PR, I tried with I'm closing the issue as everything seems to be solved. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
12.0.7
What version of Node.js are you using?
17.1.0
What browser are you using?
Chromium, Brave, Firefox
What operating system are you using?
Archlinux
How are you deploying your application?
locally with yarn dev and also yarn start
Describe the Bug
I get
Unhandled Runtime Error, incompatible-href-as
when using _middleware.ts to do hostname rewrites, other details and screenshots in this issue : vercel/examples#55 .The error happens when cloning this Vercel example repo https://github.com/vercel/examples/tree/main/edge-functions/hostname-rewrites or just with a minimal example as shown below (I have no
<Link/>
or<a/>
in my code)The error comes under these conditions :
Code
pages/_middleware.ts
working when visiting /newpage (if the used subdomain path has been generated at build, if not it triggers the error) with getStaticProps :
pages/_sites/[site]/newpage.tsx
Not working when visiting /newpage, get the error
Expected Behavior
No error.
To Reproduce
Run the snippets of code below to check :
Clone this repo from vercel examples https://github.com/vercel/examples/tree/main/edge-functions/hostname-rewrites to only check:
The text was updated successfully, but these errors were encountered: