\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```",[2917,2918],{"name":2905,"color":2906},{"name":2919,"color":2920},"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.6751687,{"description":2927,"labels":2928,"number":2933,"owner":2908,"repository":2908,"state":2909,"title":2934,"updated_at":2935,"url":2936,"score":2937},"### 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_",[2929,2930],{"name":2905,"color":2906},{"name":2931,"color":2932},"needs reproduction","FBCA04",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.6858601,{"description":2939,"labels":2940,"number":2942,"owner":2908,"repository":2908,"state":2909,"title":2943,"updated_at":2944,"url":2945,"score":2946},"### Environment\n\n------------------------------\n- Operating System: Darwin\n- Node Version: v22.14.0\n- Nuxt Version: 3.17.1\n- CLI Version: 3.25.0\n- Nitro Version: 2.11.11\n- Package Manager: npm@11.1.0\n- Builder: -\n- User Config: compatibilityDate, app, devtools, ssr, modules, pinia, vite\n- Runtime Modules: @nuxt/test-utils@3.17.2, @pinia/nuxt@0.11.0\n- Build Modules: -\n------------------------------\n\n### Reproduction\n\nAfter installing the Pinia module and creating a new store and plugin, use the following code:\n\nAs [Pinia docs](https://pinia.vuejs.org/ssr/#Using-the-store-outside-of-setup-) to use the store outside setup(), we need to pass the context to the store function as an argument:\n\n```ts\nexport default defineNuxtPlugin(async ({ $pinia, vueApp }) => {\n // Weird behavior\n const pinia_old = $pinia // type: unknown\n const pinia = vueApp.$nuxt.$pinia // type: Pinia\n})\n```\n\n### Describe the bug\n\nThe strange thing is that the correct type is recognized inside nuxtApp.vueApp.$nuxt.$pinia but not in nuxtApp.$pinia, even though it exists.\n\nYou can solve this issue with type casting:\n\n```ts\nexport default defineNuxtPlugin(async ({ $pinia }) => {\n const pinia = $pinia as Pinia\n const configStore = useConfigStore(pinia)\n})\n```\n\nMeanwhile, this works well in Nuxt 2! It correctly inherits the type in the context.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\n\n```",[2941],{"name":2905,"color":2906},32055,"Pinia unknown type on NuxtPlugin","2025-05-09T11:09:48Z","https://github.com/nuxt/nuxt/issues/32055",0.69325894,{"description":2948,"labels":2949,"number":2954,"owner":2908,"repository":2908,"state":2909,"title":2955,"updated_at":2956,"url":2957,"score":2958},"### 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",[2950,2953],{"name":2951,"color":2952},"3.x","29bc7f",{"name":2905,"color":2906},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.6990259,{"labels":2960,"number":2965,"owner":2908,"repository":2908,"state":2909,"title":2966,"updated_at":2967,"url":2968,"score":2969},[2961,2962],{"name":2951,"color":2952},{"name":2963,"color":2964},"upstream-bug","B60205",13686,"Async Middleware - No active Pinia","2023-01-19T17:03:28Z","https://github.com/nuxt/nuxt/issues/13686",0.7036772,{"description":2971,"labels":2972,"number":2975,"owner":2908,"repository":2908,"state":2909,"title":2976,"updated_at":2977,"url":2978,"score":2979},"### 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",[2973,2974],{"name":2951,"color":2952},{"name":2905,"color":2906},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.70387125,{"description":2981,"labels":2982,"number":2985,"owner":2908,"repository":2908,"state":2909,"title":2986,"updated_at":2987,"url":2988,"score":2989},"### Environment\n\n------------------------------\r\n- Operating System: `Darwin`\r\n- Node Version: `v18.13.0`\r\n- Nuxt Version: `3.3.1`\r\n- Nitro Version: `2.3.1`\r\n- Package Manager: `yarn@1.22.19`\r\n- Builder: `vite`\r\n- User Config: `imports`, `inlineRSSStyles`, `modules`, `sourcemap`, `runtimeConfig`\r\n- Runtime Modules: `@pinia/nuxt@0.4.6`, `@nuxtjs/tailwindcss@6.4.0`\r\n- Build Modules: `-`\r\n------------------------------\r\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-ufjyfr-15hrmu?file=nuxt.config.ts,app.vue,middleware%2Ftest.global.js,server%2Fplugins%2Ftest.js\r\n\r\nTry to build with `yarn build` and run `node .output/server/index.mjs`\n\n### Describe the bug\n\nI'm using pinia store in `server/plugins` to adjust SSR output html content, it works just fine in `yarn dev` but fails when I build the project with:\r\n\r\nError [ERR_MODULE_NOT_FOUND]: Cannot find module '.../project/.output/server/node_modules/pinia/dist/pinia' imported from .../project/.output/server/index.mjs\r\n\r\nI see .mjs file is present in the path it's searching: `.../project/.output/server/node_modules/pinia/dist/pinia.mjs`.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[2983,2984],{"name":2951,"color":2952},{"name":2905,"color":2906},19847,"Cannot find module `pinia/dist/pinia` when store is used from `server/plugins` `defineNitroPlugin` only when built","2023-06-28T18:30:07Z","https://github.com/nuxt/nuxt/issues/19847",0.70596254,{"labels":2991,"number":2994,"owner":2908,"repository":2908,"state":2909,"title":2995,"updated_at":2996,"url":2997,"score":2998},[2992,2993],{"name":2951,"color":2952},{"name":2905,"color":2906},14448,"Pinia Error: __vite_ssr_import_1__.useStore is not a function","2023-01-19T17:35:26Z","https://github.com/nuxt/nuxt/issues/14448",0.7059736,{"description":3000,"labels":3001,"number":3003,"owner":2908,"repository":2908,"state":2909,"title":3004,"updated_at":3005,"url":3006,"score":3007},"### 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```",[3002],{"name":2905,"color":2906},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.7067272,["Reactive",3009],{},["Set"],["ShallowReactive",3012],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fFFMpHo6P2JfpFSrasG4tBP8VwhhHj0PyAordVkD04uM":-1},"/nuxt/test-utils/571"]