error Error: invariant expected app router to be mounted at
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
I'm getting this error:
whenever I use both the
This error was introduced at some point after next 13.4.4.
Minimal reproduction: https://github.com/joncoronel/testing-mantine-7
error Error: invariant expected app router to be mounted
at HomePage whenever I use both the
useRouter hook and then export const runtime = "edge"; in the route.This error was introduced at some point after next 13.4.4.
Minimal reproduction: https://github.com/joncoronel/testing-mantine-7
22 Replies
@Giant panda I'm getting this error: error Error: invariant expected app router to be mounted
at HomePage
whenever I use both the `useRouter` hook and then `export const runtime = "edge";` in the route.
This error was introduced at some point after next 13.4.4.
Minimal reproduction: https://github.com/joncoronel/testing-mantine-7
U should use hooks inside the rendering component not outside function
he does: https://github.com/joncoronel/testing-mantine-7/blob/master/app/components/ClientComponent.js (prob tried to simplify for post)
I'm sorry, I saw the above snippet and got confused.
if you disable
swcMinify, does it work? (i kinda doubt it tho)@riský if you disable `swcMinify`, does it work? (i kinda doubt it tho)
Giant pandaOP
Nope, just tried it.
To clarify(just edited the post to include it), this error occurs directly as a result of using
export const runtime = "edge"; on the route and then using useRouter within a client component in that route.yeah i gathered that
imo as it seems like a bug, you should use this repo and submit issue
as everything looks normal (and you say it works without edge)
Does this release fix this for you: https://github.com/vercel/next.js/releases/tag/v13.4.8-canary.1
Oh, you already at 13.5
@dumbboy Does this release fix this for you: https://github.com/vercel/next.js/releases/tag/v13.4.8-canary.1
Giant pandaOP
Yeah I can confirm this error does not occur on 13.4.4 but starting happening in some version afterwards.
Seems like this is the exact issue you are facing? https://github.com/vercel/next.js/issues/55013
@riský as everything looks normal (and you say it works without edge)
Giant pandaOP
Yep error is gone once I remove the edge runtime. This wasn't really an issue before but it messes with UI component libraries like Mantine and NextUI since the error prevents color scheme styling from applying on initial load.
@dumbboy Seems like this is the exact issue you are facing? https://github.com/vercel/next.js/issues/55013
Giant pandaOP
Yep exact same issue. So based on that post, this bug was introduced with 13.4.8
@dumbboy Seems like this is the exact issue you are facing? https://github.com/vercel/next.js/issues/55013
lol i should have actualy looked at issues...
@riský lol i should have actualy looked at issues...
I don't google for these latest version issues, I just search keywords in Github Issues
So, according to this comment: https://github.com/vercel/next.js/issues/55013#issuecomment-1712330213.
It should be fixed in
It should be fixed in
next@13.4.8-canary.1 version right?@dumbboy So, according to this comment: https://github.com/vercel/next.js/issues/55013#issuecomment-1712330213.
It should be fixed in `next@13.4.8-canary.1` version right?
Giant pandaOP
I think they're trying to say the issue was introduced with that update spceifically
@Giant panda I think they're trying to say the issue was introduced with that update spceifically
Oh, I'm sorry, I didn't read properly
SO, the issue is still open IG