useNuxtApp() and useRuntimeConfig not available in pinia store during SSR
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v18.7.0
- Nuxt Version:
2.16.0-27616340.013f051b
- Package Manager:
yarn@3.2.1
- Builder:
webpack
- User Config:
buildDir
,srcDir
,bridge
,components
,ssr
,dev
,alias
,image
,generate
,head
,typescript
,publicRuntimeConfig
,privateRuntimeConfig
,css
,loading
,loadingIndicator
,plugins
,buildModules
,modules
,proxy
,axios
,vuetify
,build
,serverHandlers
,devServerHandlers
- Runtime Modules:
@nuxtjs/vuetify@1.12.3
,@nuxt/image@0.7.1
,@nuxtjs/axios@5.13.6
,@nuxtjs/proxy@2.1.0
,nuxt-social-meta@1.0.0
- Build Modules:
()
,nuxt-storm@1.1.3
,nuxt-compress@5.0.0
,@pinia/nuxt@0.3.1
,~/modules/apolloSSR
,@nuxt/bridge@3.0.0-27639120.e7a7f9b
Reproduction
https://github.com/vuejs/pinia/discussions/1526
Describe the bug
I am getting this error
When running this pinia actions during SSR
I rolled back to the old this.$nuxt for now to temporarily solve the issue
Additional context
The page being loaded uses the default.vue layout which has an apollo query “labels”
So that, together with this query causes the error.
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:13
Top Results From Across the Web
nuxt.js - Testing Pinia store inside Nuxt3 with vitest throws ...
In your test file, use the vi.mock() function to mock the #imports package. vi.mock('#imports', () => { return { useRuntimeConfig() ...
Read more >Nuxt Configuration Reference
The folder name for the built site assets, relative to baseURL (or cdnURL if set). This is set at build time and should...
Read more >How to Quickly Build a Blog with Nuxt and ButterCMS
In this tutorial, you'll learn how you can quickly build a blog using Nuxt and ButterCMS. Hint: It's easier than you think.
Read more >site:self.nuxt - Reddit post and comment search - SocialGrep
There is also quite some copy-pasting of code during lessons in the video course. Of course the main focus of this course isn't...
Read more >Introduction to Nuxt 3 modules - DEV Community
As there is no Nuxt 3 module template repository nor an article how to create one, I thought it would be a good...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s available now but not have a type support.
I struggled with this for a while, the solution for me was to instantiate the store before I called a method inside of it.
In my use case, I was trying to build Bread Crumbs aided by the current Route, my code looked like this:
Which would error out with the
Nuxt Instance Unavailable
.What I ended up having to do, was to call the store on my page, before my
useSEO
composable which actually calls the “makeBreadcumbList” function.I found this doc on Pinia’s site which clarified what was happening in my case.
https://pinia.vuejs.org/core-concepts/outside-component-usage.html
Hope this helps.