[Nuxt 3] Nuxt instance unavailable in pinia store during SSR #1826
Unanswered
LudoFont
asked this question in
Help and Questions
Replies: 2 comments 3 replies
-
I've found a workaround for this. This causes exception export const useStore = defineStore('', {
actions: {
foo () {
useNuxtApp()
},
},
}) But with pinia store in composion-api style export const useStore = defineStore('', () => {
const nuxtApp = useNuxtApp()
return {
foo () {},
}
}) |
Beta Was this translation helpful? Give feedback.
2 replies
-
Same here, any solution? @LudoFont @VladStepanov I'm trying this inside a composable SSR and its returning the 'nuxt instance unavailable'
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Reproduction
/
Steps to reproduce the bug
When I run some async actions during SSR (asyncData, plugins ...) and I try to use some hooks from Nuxt (useNuxtApp, useRuntimeConfig, useCookie ...), it crashs with the error "nuxt instance unavailable", only after an await code line.
and for exemple, a plugin, only server side :
plugins/myPlugin.server.js
Expected behavior
The nuxt hooks should be available, even after an await method call
Actual behavior
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions