\n \u003CNuxtWelcome />\n \u003C/div>\n\u003C/template>\n\u003Cscript lang=\"ts\">\nconst store = useCounterStore()\n\u003C/script>\n\n```\nwith clean nuxt.config.ts\n```ts\n// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-11-01',\n devtools: { enabled: true },\n modules: ['@pinia/nuxt']\n})\n```\n\n### Describe the bug\n\nAfter upgrading Nuxt to version 3.15.0 I cannot even start my app as I am getting `500\ninternal server error`. \nIn the console I am getting twice\n```zsh\n[nuxt] [request error] [unhandled] [500] [🍍]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\nSee https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\nThis will fail in production.\n```\nI tried every new Nuxt version since, but with the same result. I tried to isolate the pinia module and created empty project from the starter template and the problem persists, so there is no module conflict.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\nERROR [nuxt] [request error] [unhandled] [500] [🍍]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\nSee https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\n```",[2010,2011],{"name":1985,"color":1986},{"name":2012,"color":2013},"possible regression","B90A42",30751,"Pinia module causing [500] internal server error after upgrading to Nuxt version to 3.15.x","2025-02-03T10:44:22Z","https://github.com/nuxt/nuxt/issues/30751",0.6915755,{"description":2020,"labels":2021,"number":2026,"owner":1988,"repository":1988,"state":2002,"title":2027,"updated_at":2028,"url":2029,"score":2030},"### Environment\n\n------------------------------\r\n- Operating System: Linux\r\n- Node Version: v18.16.1\r\n- Nuxt Version: 3.6.5\r\n- Nitro Version: 2.5.2\r\n- Package Manager: pnpm@8.6.11\r\n- Builder: vite\r\n- User Config: ssr, devtools, imports, modules, css, svgo, i18n, headlessui, image, components, extends, runtimeConfig, linkChecker, googleFonts, build, vite, nitro\r\n- Runtime Modules: @nuxtjs/eslint-module@4.1.0, @pinia/nuxt@0.4.11, @nuxtjs/i18n@8.0.0-rc.2, nuxt-svgo@3.4.0, nuxt-headlessui@1.1.4, @nuxt/image@1.0.0-rc.1, nuxt-typed-router@3.2.5, @formkit/nuxt@0.17.5, @nuxtjs/tailwindcss@6.8.0, nuxt-icon@0.4.2, @nuxtjs/google-fonts@3.0.2, @vueuse/nuxt@10.3.0\r\n- Build Modules: -\r\n------------------------------\n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-ntrsan-qorvzj?file=app.vue\r\n\r\n1. Make pinia store with function for example \"fetchData\" that returns `useFetch('some-endpoint')`\r\n2. Use store inside `script setup` and call `store.fetchData`\r\n3. Try to render data returned from `store.fetchData` in the template\r\n4. Data remains undefined\n\n### Describe the bug\n\nUseFetch doesn't work if it's inside pinia store, despite its invocation from within the \u003Cscript setup> section.\r\n\r\nI like to keep my API calls in pinia modules. For example all API calls related to user would be in user.ts pinia module. Unfortunately I realized that it's not possible when using `useFetch` Nuxt composable. Could this be considered a bug, or is it an intentional behavior?\n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[2022,2025],{"name":2023,"color":2024},"3.x","29bc7f",{"name":1985,"color":1986},22549,"UseFetch doesn't work if it's inside pinia store, despite its invocation from within the \u003Cscript setup> section","2023-08-09T10:36:06Z","https://github.com/nuxt/nuxt/issues/22549",0.6950453,{"description":2032,"labels":2033,"number":2036,"owner":1988,"repository":1988,"state":2002,"title":2037,"updated_at":2038,"url":2039,"score":2040},"### Environment\n\n------------------------------\r\n- Operating System: Linux\r\n- Node Version: v18.20.2\r\n- Nuxt Version: 3.10.3\r\n- CLI Version: 3.11.1\r\n- Nitro Version: 2.9.6\r\n- Package Manager: yarn@4.1.1\r\n- Builder: -\r\n- User Config: devtools, modules, piniaPersistedstate, watch\r\n- Runtime Modules: @pinia/nuxt@0.5.1, @pinia-plugin-persistedstate/nuxt@1.2.0\r\n- Build Modules: -\r\n------------------------------\n\n### Reproduction\n\nhttps://gitlab.com/javier-sedano/ufe5\r\n\r\nHowever, I have applied the workaround defined in https://github.com/nuxt/nuxt/issues/22943#issuecomment-1702506306 so in order to reproduce it again, comment out some lines:\r\n\r\nThe architecture is a bit complex (it is a microfrontend poc) so use:\r\n\r\nyarn install\r\nyarn initAll\r\nedit app-core/node_modules/javier-sedano-ufe5-store-library-pinia/src/stores/total.store.ts and comment out the workaround from lines 7-8.\r\nyarn dev\r\nbrowse localhost:4100\r\n\r\nWARNING: upon reload, it does not fail anymore, it only fails in the first load after a fresh start.\r\n\n\n### Describe the bug\n\nThe console complains with:\r\n\r\nLooks like the bug was detected in Nuxt 3.7.0 and fixed in 3.7.something. It has appeared again, I think. I have verified that it works with Nuxt 3.10.2 and fails with Nuxt 3.10.3 (edit app-core/package.json to check this).\r\n\n\n### Additional context\n\nMateuszStawski says in https://github.com/nuxt/nuxt/issues/22943#issuecomment-2119360501 that it fails for him as well.\n\n### Logs\n\n_No response_",[2034,2035],{"name":1985,"color":1986},{"name":1999,"color":2000},27447,"'getActivePinia()\" was called but there was no active Pinia' is back","2024-10-17T08:09:57Z","https://github.com/nuxt/nuxt/issues/27447",0.70033896,{"description":2042,"labels":2043,"number":2046,"owner":1988,"repository":1988,"state":2002,"title":2047,"updated_at":2048,"url":2049,"score":2050},"### Environment\n\n- Operating System: Linux\r\n- Node Version: v16.20.0\r\n- Nuxt Version: 3.7.2\r\n- CLI Version: 3.8.3\r\n- Nitro Version: 2.6.3\r\n- Package Manager: npm@9.4.2\r\n- Builder: -\r\n- User Config: modules, nitro, runtimeConfig\r\n- Runtime Modules: @pinia/nuxt@0.4.11\r\n- Build Modules: \n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-bwuqrs\n\n### Describe the bug\n\nIn my personal project, I have to do two requests on the server side. For this, I was using useAsyncData, making one request, and after it, doing another with the data of the previous request. \r\n\r\nit worked normally when I was using direct axios service. However, when I created a plugin for $api and injected it in the nuxt context, the second request started to throw an error: **A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function**.\r\n\r\nI do these requests inside pinia store, calling useNuxtApp().$api inside of the store, for each request.\r\n\r\nExample of **useAsyncData**:\r\n```\r\nawait useAsyncData('initStore', async () => {\r\n if (process.server) {\r\n const settingsStore = useSettingsStore();\r\n // Change condition to works\r\n if (true) {\r\n await settingsStore.get();\r\n await settingsStore.get();\r\n } else {\r\n console.log('No error');\r\n await Promise.allSettled([settingsStore.get(), settingsStore.get()]);\r\n }\r\n }\r\n});\r\n```\r\n\r\n**Pinia store:** \r\n```\r\nexport const useSettingsStore = defineStore('settingsStore', {\r\n state: () => ({}),\r\n actions: {\r\n async get() {\r\n try {\r\n const { $api } = useNuxtApp();\r\n console.log('$api passed');\r\n } catch (err) { \r\n console.log('error inside catch', err);\r\n } \r\n },\r\n },\r\n});\r\n```\r\n\r\nDo I have to instantiate useNuxtApp inside useAsyncData and pass it to actions inside pinia? Why the second request is throwing this error? Is there a solution for that?\r\n\r\nPs.: If I do both requests at the same time, It works normally, the nuxt context inside pinia works.\r\n\r\n\r\n\r\n\r\n\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\nError: [nuxt] A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function. This is probably not a Nuxt bug. Find out more at `https://nuxt.com/docs/guide/concepts/auto-imports#using-vue-and-nuxt-composables`.\n```\n",[2044,2045],{"name":2023,"color":2024},{"name":1985,"color":1986},23192,"Call useNuxtApp two times in pinia store inside useAsyncData - Nuxt context instance error","2023-09-13T22:49:03Z","https://github.com/nuxt/nuxt/issues/23192",0.7021679,{"description":2052,"labels":2053,"number":2055,"owner":1988,"repository":1988,"state":2002,"title":2056,"updated_at":2057,"url":2058,"score":2059},"### Environment\n\n------------------------------\n- Operating System: Linux\n- Node Version: v20.9.0\n- Nuxt Version: 3.15.0\n- CLI Version: 3.17.2\n- Nitro Version: 2.10.4\n- Package Manager: yarn@1.22.19\n- Builder: -\n- User Config: default\n- Runtime Modules: @pinia/nuxt@0.9.0\n- Build Modules: -\n------------------------------\n\n\n### Reproduction\n\nhttps://codesandbox.io/p/devbox/compassionate-black-jrfrgr?file=%2Fpages%2Findex.vue%3A5%2C12&workspaceId=ws_C8YsBz2W6pCYjgPZ5hNEpq\n\n### Describe the bug\n\nhaving a key with same name as a variable that uses a store breaks nuxt and pinia integration somehow.\ncheck `index.vue` page to see the reproduction\n\n### Additional context\n\nIt was super hard to track this down, but I hope this minimal reproduction can prove that this is a bug.\n\n### Logs\n\n```shell-script\n ERROR [nuxt] [request error] [unhandled] [500] [🍍]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\nSee https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\nThis will fail in production.\n```",[2054],{"name":1985,"color":1986},30430,"Having a variable with same name as key in definePageMeta breaks pinia integration","2025-01-02T11:30:26Z","https://github.com/nuxt/nuxt/issues/30430",0.70360994,{"description":2061,"labels":2062,"number":2065,"owner":1988,"repository":1988,"state":2002,"title":2066,"updated_at":2067,"url":2068,"score":2069},"### Environment\r\n\r\n \"dependencies\": {\r\n \"@pinia/nuxt\": \"^0.5.1\",\r\n \"axios\": \"^1.6.8\",\r\n \"lodash\": \"^4.17.21\",\r\n \"nuxt\": \"^3.11.1\",\r\n \"nuxt-lodash\": \"^2.5.3\",\r\n \"pinia\": \"^2.1.7\",\r\n \"vue\": \"^3.4.21\",\r\n \"vue-router\": \"^4.3.0\"\r\n }\r\n\r\nexport default defineNuxtConfig({\r\n devtools: { enabled: true },\r\n \r\n modules: [\r\n \r\n '@pinia/nuxt'\r\n ],\r\n\r\n pinia: {\r\n autoImports: ['defineStore', 'acceptHMRUpdate', 'storeToRefs', 'mapStores', 'getActivePinia','usePinia'],\r\n // storesDirs: ['./stores/**'],\r\n },\r\n})\r\n\r\nPinia auto imports invalid\r\n\r\n### Reproduction\r\n\r\nhttps://github.com/gllinzbk1/nuxt3.111.git\r\n\r\n### Describe the bug\r\n\r\n\r\n\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[2063,2064],{"name":2023,"color":2024},{"name":1985,"color":1986},26456," 3.11.1 Pinia not working","2024-03-25T07:44:43Z","https://github.com/nuxt/nuxt/issues/26456",0.7066342,{"description":2071,"labels":2072,"number":2075,"owner":1988,"repository":1988,"state":2002,"title":2076,"updated_at":2077,"url":2078,"score":2079},"### Environment\r\n\r\nNuxi 3.0.0-rc.11\r\nRootDir: /tmp/example-nuxt-3\r\nNuxt project info: \r\n\r\n------------------------------\r\n- Operating System: `Linux`\r\n- Node Version: `v18.7.0`\r\n- Nuxt Version: `3.0.0-rc.11`\r\n- Nitro Version: `0.5.4`\r\n- Package Manager: `npm@8.15.0`\r\n- Builder: `vite`\r\n- User Config: `css`, `buildModules`\r\n- Runtime Modules: `-`\r\n- Build Modules: `@pinia/nuxt@0.4.2`\r\n\r\n\r\n### Reproduction\r\n\r\nhttps://github.com/cyberaesthete/example-nuxt-3-pinia\r\n\r\ncommit for rc11 reproduction\r\nhttps://github.com/cyberaesthete/example-nuxt-3-pinia/commit/f9a96e543af526d96ec029671a9220ea81fd97de\r\n\r\ncommit for rc10 reproduction\r\nhttps://github.com/cyberaesthete/example-nuxt-3-pinia/commit/ee5fb837704380572da89ce56688e4b1ec74de91\r\n\r\n### Describe the bug\r\n\r\nNot sure if this is a pinia or nuxt3 issue, but pinia throws an error when a server endpoint uses a pinia store.\r\n\r\nThis commit (https://github.com/cyberaesthete/example-nuxt-3-pinia/commit/ee5fb837704380572da89ce56688e4b1ec74de91) shows the minimal changes to use pinia in the server endpoint.\r\n\r\nTo reproduce the bug:\r\n```\r\ngit clone https://github.com/cyberaesthete/example-nuxt-3-pinia &&\r\n cd example-nuxt-3-pinia &&\r\n npm install &&\r\n npm run build &&\r\n node .output/server/index.mjs\r\n```\r\n\r\nThen open in browser. Error logs should show when rendering `/`\r\n\r\n### Additional context\r\n\r\nOriginal discussion here: https://github.com/nuxt/framework/discussions/7282\r\n\r\nAccording to a pinia developer: https://github.com/vuejs/pinia/issues/1688#issuecomment-1261339449\r\n> It works without Nuxt so I suspect you need to add support for mjs files like at https://github.com/piniajs/vue-3-cli-webpack-4\r\nNot sure how this is applicable.\r\n\r\nThe example is cloned from: https://github.com/piniajs/example-nuxt-3\r\n\r\n### Logs\r\n\r\n```shell\r\n✔ You can preview this build using node .output/server/index.mjs nitro 00:13:29\r\nListening http://[::]:3000\r\n[nuxt] [request error] [unhandled] [500] Cannot find module '/tmp/example-nuxt-3/.output/server/node_modules/pinia/dist/pinia' imported from /tmp/example-nuxt-3/.output/server/chunks/hello.mjs\r\n at new NodeError (node:internal/errors:387:5)\r\n at finalizeResolution (node:internal/modules/esm/resolve:404:11)\r\n at moduleResolve (node:internal/modules/esm/resolve:965:10)\r\n at defaultResolve (node:internal/modules/esm/resolve:1173:11)\r\n at nextResolve (node:internal/modules/esm/loader:173:28)\r\n at ESMLoader.resolve (node:internal/modules/esm/loader:852:30)\r\n at ESMLoader.getModuleJob (node:internal/modules/esm/loader:439:18)\r\n at ModuleWrap.\u003Canonymous> (node:internal/modules/esm/module_job:76:40)\r\n at link (node:internal/modules/esm/module_job:75:36)\r\n```\r\n",[2073,2074],{"name":2023,"color":2024},{"name":1985,"color":1986},15058,"[pinia] use of store in server endpoint throws an error when built for production","2023-01-19T17:44:19Z","https://github.com/nuxt/nuxt/issues/15058",0.7105714,{"description":2081,"labels":2082,"number":2084,"owner":1988,"repository":1988,"state":2002,"title":2085,"updated_at":2086,"url":2087,"score":2088},"### Environment\n\n------------------------------\n- Operating System: Linux\n- Node Version: v20.14.0\n- Nuxt Version: 3.13.2\n- CLI Version: 3.13.2\n- Nitro Version: 2.9.7\n- Package Manager: bun@1.1.32\n- Builder: -\n- User Config: compatibilityDate, devtools, runtimeConfig, pinia, app, i18n, extends, modules, nitro, scripts\n- Runtime Modules: vuetify-nuxt-module@0.18.3, @pinia/nuxt@0.5.4, @nuxt/image@1.8.1, @pinia-plugin-persistedstate/nuxt@1.2.1, @nuxtjs/i18n@8.5.5, nuxt-swiper@1.2.2, @nuxt/scripts@0.9.5\n- Build Modules: -\n------------------------------\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/areal-bug?file=stores%2Fauth.store.ts\n\n### Describe the bug\n\nHi, \nI ran into a strange problem. \nPinia is telling me to pass app to my store outside of the setup to avoid sharing state between all requests:\nhttps://pinia.vuejs.org/core-concepts/outside-component-usage.html#SSR-Apps\n\nThe problem is after doing everything pinia and chatgpt said, still i get shared state between my users. For example a random user can open my website in incognito tab and get logged into my website with last user login info. \nThe pain is also there is no cookie set for that random user and i cant see my user store in browser cookie. \nSo where that information come from ? Where that token store when there is no store in cookie?\nHow can i avoid this shared login state?\n\nThis is my store:\n```typescript\nimport {DEFAULT_LOGIN_CREDENTIAL, DEFAULT_LOGIN_SESSION, type LoginCredentialType} from \"~/stores/auth.types\"\n\nexport const useAuthStore = defineStore('auth', {\n state: (): AuthStoreType => ({\n phone: null,\n login_session: DEFAULT_LOGIN_SESSION,\n login_credential: DEFAULT_LOGIN_CREDENTIAL,\n user_data: DEFAULT_USER_DATA\n }),\n\n getters: {\n // Check phone number validity\n isPhoneValid(): boolean {\n return this.phone !== null && /^0[0-9]{2}[0-9]{8}$/.test(this.phone ?? '')\n },\n\n // Is token exists\n isToken(): boolean {\n return (\n this.login_credential.access_token !== null &&\n this.login_credential.refresh_token !== null &&\n this.login_credential.access_token !== undefined &&\n this.login_credential.refresh_token !== undefined &&\n this.login_credential.access_token !== \"\" &&\n this.login_credential.refresh_token !== \"\"\n )\n }\n },\n\n actions: {\n // Login and set credentials\n login(credentials: LoginCredentialType) { this.login_credential = credentials },\n refresh(token: string) { this.login_credential.access_token = token },\n\n // Update user data\n updateUserData(data: { [key: string]: any }) {\n const ud: UserDataType = this.user_data\n\n for (const dataKey in data) {\n ud[dataKey as keyof UserDataType] = data[dataKey]\n }\n },\n\n // Fetch profile\n async fetchProfile(): Promise\u003C{ status: boolean, message?: string }> {\n const t = this\n\n return await useAuthApi\u003CUserDataType>('/account/profile/').then((value) => {\n if (value.status && value.status === 200) {\n this.updateUserData({\n full_name: value.data.full_name,\n gender: value.data.gender,\n image: value.data.image\n })\n return { status: true }\n }\n\n else return { status: false, message: 'inv_data' }\n }).catch((reason) => {\n t.logout()\n console.log(reason)\n\n if (reason.response && reason.response.status) {\n switch (reason.response.status) {\n case 401:\n return { status: false, message: 'login_exp' }\n case 500:\n return { status: false, message: 'srv_err' }\n default:\n return { status: false, message: 'srv_err' }\n }\n }\n else return { status: false, message: 'smt_wrong' }\n })\n },\n\n // Logout user and reset credential session\n logout() {\n this.login_credential = DEFAULT_LOGIN_CREDENTIAL\n this.user_data = DEFAULT_USER_DATA\n this.$persist()\n },\n\n // Reset and remove login session\n removeLoginSession() {\n this.login_session = DEFAULT_LOGIN_SESSION\n this.phone = null\n },\n\n // Refresh login session\n refreshLoginSession() {\n this.login_session.otp_date = null\n this.login_session.time = null\n this.login_session.code = null\n },\n\n // Retrieve tokens\n credentials() {\n const credential = this.login_credential\n return {\n access_token: `Bearer ${credential.access_token}`,\n refresh_token: `Bearer ${credential.refresh_token}`\n } as LoginCredentialType\n },\n\n async sendOtp(translate: (text: string) => string, refresh?: boolean) {\n await useApi('/account/auth/', {\n body: {\n phone_number: this.phone,\n user_type: 3\n },\n method: \"POST\"\n }).then((value) => {\n if (value.status && value.status === 200)\n refresh ? location.reload() : useRouter().push('/auth/otp')\n\n else useToast(translate('global.errors.unknown_status'), \"error\")\n }).catch((reason) => {\n console.log('Error while sending login request:', reason)\n\n if (reason.response && reason.response.status) {\n switch (reason.response.status) {\n case 400 | 201:\n useToast(translate('global.errors.phone_invalid'), \"error\")\n break\n case 500:\n useToast(translate('global.errors.server_error'), \"error\")\n break\n default:\n useToast(translate('global.errors.something_went_wrong'), \"error\")\n break\n }\n }\n else useToast(translate('global.errors.something_went_wrong'), \"error\")\n })\n }\n },\n\n persist: {\n storage: persistedState.cookiesWithOptions({\n sameSite: 'strict',\n secure: true,\n }),\n },\n})\n```\n\nI use \"@pinia-plugin-persistedstate/nuxt\": \"^1.2.1\", to store my state in cookie. \n\nAnd this is my middleware:\n\n```typescript\nexport default defineNuxtRouteMiddleware(async (to) => {\n const nuxtApp = useNuxtApp()\n const store = useAuthStore(nuxtApp.$pinia)\n \n const isAuthPage = [\"/auth\", \"/auth/otp\"].includes(to.path)\n\n console.log(\"isAuthPage:\", isAuthPage)\n\n\n if (!isAuthPage && !store.isToken) {\n store.logout()\n\n console.log(\"con1\")\n\n return navigateTo('/auth')\n }\n\n if (store.isToken) {\n console.log(\"con2\")\n const profile = await store.fetchProfile()\n console.log(\"profile:\", profile)\n\n if (!profile.status) {\n console.log(\"con3\")\n\n store.logout()\n\n if (isAuthPage) {\n console.log(\"con4\")\n\n if (profile.message && (to.query.res === undefined || to.query.res === null || to.query.res !== profile.message))\n return navigateTo(`/auth?res=${profile.message}`, {redirectCode: 301})\n\n return\n }\n else return navigateTo(profile.message ? `/auth?res=${profile.message}` : '/auth', { redirectCode: 301 })\n }\n\n\n else if (isAuthPage) {\n console.log(\"con5\")\n\n return navigateTo('/app')\n }\n }\n})\n```\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\n\n```",[2083],{"name":1985,"color":1986},29899,"Pinia shared state on middleware","2024-11-21T10:49:28Z","https://github.com/nuxt/nuxt/issues/29899",0.71265286,["Reactive",2090],{},["Set"],["ShallowReactive",2093],{"TRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"FFMpHo6P2JfpFSrasG4tBP8VwhhHj0PyAordVkD04uM":-1},"/nuxt/test-utils/571"]