bridge
bridge copied to clipboard
Nuxt-bridge useNuxtApp() not available inside middleware
Environment
- Operating System:
Darwin
- Node Version:
v16.15.0
- Nuxt Version:
2.16.0-27616340.013f051b
- Package Manager:
[email protected]
- Builder:
webpack
- User Config:
srcDir
,bridge
,ssr
,dev
,webpackOptimisations
,alias
,image
,generate
,head
,typescript
,publicRuntimeConfig
,privateRuntimeConfig
,css
,loading
,loadingIndicator
,plugins
,components
,buildModules
,modules
,proxy
,axios
,vuetify
,build
,serverHandlers
,devServerHandlers
- Runtime Modules:
@nuxtjs/[email protected]
,@nuxt/[email protected]
,@nuxtjs/[email protected]
,@nuxtjs/[email protected]
,[email protected]
- Build Modules:
()
,[email protected]
,[email protected]
,[email protected]
,@pinia/[email protected]
,@nuxt/[email protected]
Reproduction

Describe the bug
useNuxtApp() inside a middleware fails with an error
Additional context
No response
Logs
No response
Can you share minimal reproduction or middleware code?
@antlionguard will provide one tomorrow. Is useNuxtApp working for you inside the middleware on nuxt-bridge?
@antlionguard will provide one tomorrow. Is useNuxtApp working for you inside the middleware on nuxt-bridge?
Yes itβs works at my project.
Hello @antlionguard here is a repro https://github.com/stephenjason89/nuxt-bridge
Just visit index.vue and you'll see the error.
middleware is defined inside the default.vue layout.
Please ignore the old comments about a different error. It was already resolved hehe.
Thanks
i think @danielroe should look at this
Thank you @antlionguard & @danielroe
Seems to be working: https://stackblitz.com/github/stephenjason89/nuxt-bridge
That's weird. I'll try again.
Hello @danielroe I have tried cloning the repo again, yarn install then yarn run dev but still getting the error.
Then i tried npm just like in stackblitz just to be sure. But still getting the error.
This is the line that throws the error
Hello @danielroe I have tried cloning the repo again, yarn install then yarn run dev but still getting the error.
Then i tried npm just like in stackblitz just to be sure. But still getting the error.
This is the line that throws the error
You should try remove yarn lock and install all packages again
@antlionguard I just tried to remove yarn.lock now and yarn install. Same thing is happening for me.
here are the console errors
@danielroe I know why the stackblitz is working. SSR is false on that project because there's no .env file. Setting SSR: true in nuxt.config.ts produces the error.

It feels like something broke somewhere, completely insignificant, and now it doesn't work π
@Luferov yeah, let's wait and hope for a fix.
@danielroe I updated the reproduction to show the errors
I forgot to include my env file which makes my ssr variable true
so i just changed it here
Latest nuxt-bridge causes more bugs. Every js seems to not work. It just renders the html
please see readme
@danielroe I updated the reproduction to show the errors
I forgot to include my env file which makes my ssr variable true
so i just changed it here
Latest nuxt-bridge causes more bugs. Every js seems to not work. It just renders the html
please see readme
unfortunately if ssr: false then also doesn't work βΉοΈ
It has not responded for a while, so I am closing it. Reopen is welcome. (It would be helpful if you could provide a reproduction)