-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
TypeError: Cannot read properties of undefined (reading 'appMiddleware') #26756
Labels
Comments
huang-julien
added
🔨 p3-minor
✨ good reproduction
and removed
pending triage
✨ good reproduction
labels
Apr 12, 2024
Actually I think that the runtime error comes from the runWithContext (fn: any) {
if (nuxtApp._scope.active) {
return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn))
}
return callWithNuxt(nuxtApp, fn)
} |
nicolaspayot
added a commit
to nicolaspayot/nuxt
that referenced
this issue
Apr 23, 2024
danielroe
pushed a commit
that referenced
this issue
Apr 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Reproduction
https://github.com/nicolaspayot/nuxt-route-rules-undefined/
git clone git@github.com:nicolaspayot/nuxt-route-rules-undefined.git
pnpm i
pnpm run dev
Describe the bug
When using
navigateTo
with{external: true}
on client side (outside of a route middleware), we can have the following error (in particular cases):This comes from this code:
Somehow,
routeRules
isundefined
.It's happening when the
navigateTo
function is callingnuxtApp._scope.stop()
, here.Now, I believe that this can be avoided with a more "correct" usage on our end (we get the warning
[Vue warn] cannot run an inactive effect scope.
before the runtime error occurs).However, in the reproduction example, I tried to mimic real production usage that we have:
router.push
)navigateTo
with{external: true}
I'm very willing to fix this issue. For example, we could check if
routeRules
is notundefined
before trying to accessappMiddleware
.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: