NuxtN
Nuxtβ€’3y ago
erztemplerobba

Pinia in Nuxt 3 composable error

I'm using "@pinia/nuxt": "^0.4.2" in "nuxt": "^3.3.2" (SSR).
Pinia is registered in nuxtconfig/modules and works within my
.vue
files.
I'm trying to create a composable function (useSupabaseApi.ts) which will be used frequently throughout my app to interact with my store.
When I import and create the store const store = userStore(), nuxt throws this error:
[nitro] [dev] [uncaughtException] Error: [🍍]: getActivePinia was called with no active Pinia. Did you forget to install pinia?                                                                                     19:09:47
        const pinia = createPinia()
        app.use(pinia)
This will fail in production.

This happens whenever I put const store = userStore() inside the export function or outside the export function. I've checked the nuxt docs but I'm not sure what I'm doing wrong here.
Clipboard02.jpg
Was this page helpful?