You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error: Apollo client with id default not found. Use an app.runWithContext() or provideApolloClient() if you are outside of a component setup. #638
I'm getting 500 error when accessing a route that's using useQuery
500
Apollo client with id default not found. Use an app.runWithContext() or provideApolloClient() if you are outside of a component setup.
at resolveClient (http://localhost:3001/_nuxt/node_modules/@vue/apollo-composable/dist/index.mjs?v=493fcafe:58:13)
at getClient (http://localhost:3001/_nuxt/node_modules/@vue/apollo-composable/dist/index.mjs?v=493fcafe:296:12)
at start (http://localhost:3001/_nuxt/node_modules/@vue/apollo-composable/dist/index.mjs?v=493fcafe:317:20)
at useQueryImpl (http://localhost:3001/_nuxt/node_modules/@vue/apollo-composable/dist/index.mjs?v=493fcafe:589:5)
at useQuery (http://localhost:3001/_nuxt/node_modules/@vue/apollo-composable/dist/index.mjs?v=493fcafe:236:10)
at setup (http://localhost:3001/_nuxt/pages/member/overview.js:68:45)
at callWithErrorHandling (http://localhost:3001/_nuxt/node_modules/.pnpm/@vue+runtime-core@3.5.13/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?v=493fcafe:197:19)
at setupStatefulComponent (http://localhost:3001/_nuxt/node_modules/.pnpm/@vue+runtime-core@3.5.13/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?v=493fcafe:7923:25)
at setupComponent (http://localhost:3001/_nuxt/node_modules/.pnpm/@vue+runtime-core@3.5.13/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?v=493fcafe:7884:36)
at mountComponent (http://localhost:3001/_nuxt/node_modules/.pnpm/@vue+runtime-core@3.5.13/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?v=493fcafe:5240:7)
the code I'm using is
constquery=gql` query { activeTrainingProgram { id name trainingWeek { day exercises { exerciseName weight sets reps } } } }`;constsampleData={id: 1,name: "Sample Training Program",trainingWeek: {day: "Monday",exercises: [{exerciseName: "Sample Exercise",weight: 50,sets: 3,reps: 10,},],},};const{ result, loading, error, refetch }=useQuery(query);
I'm experiencing the same issue, I'm a bit amazed, isn't this a big thing ? I mean, doesn't people use this setup a lot ? How can one work around this, tried to apply the fix mentioned above but i was unable to install the module locally. My understanding is that useAsyncData uses cached data after SSR initial load so it is not an option ?
I was able to solve this issue simply by installing @vue/apollo-composable as a separate dependency in my Nuxt 4.1.1 project with npm install @vue/apollo-composable. I read through past issues in this repo and noticed that @vue/apollo-composable has come up as an issue multiple different times, for example: #639 and #550 (comment). The version of @vue/apollo-composable that I installed appears to be the same version that is provided by @nuxtjs/apollo (4.2.2), so I'm not entirely sure why this helps, but I've tested multiple times now, and it seems to be a good workaround.
I also tried @colmer's solution by adding a plugin for Apollo and that worked well too, but I no longer needed it after installing @vue/apollo-composable.
Hope this helps as a workaround for anyone else that was struggling with this like I was.
Reacted by Johannes Schweig, Suneet Jain, Anton Sitnikov, mhinton-dmi and Liya Abdrashitova
Activity
adharshmk96 commentedon Nov 19, 2024
useAsyncQueryworks wellgrelle commentedon Jan 14, 2025
I'm experiencing the same issue, I'm a bit amazed, isn't this a big thing ? I mean, doesn't people use this setup a lot ? How can one work around this, tried to apply the fix mentioned above but i was unable to install the module locally. My understanding is that useAsyncData uses cached data after SSR initial load so it is not an option ?
Here is a small reproduction of the issue: https://stackblitz.com/edit/nuxt-starter-jj8mw76x?file=pages%2Findex.vue
JoseF7830 commentedon Jan 26, 2025
I'm getting the same issue with
useMutationNuxtJs: 3.15.2
@nuxtjs/apollo: 5.0.0-alpha.14
My Nuxt Page:
s001dxp commentedon Mar 10, 2025
I don't think this project is being actively developed anymore
zwoelf commentedon Mar 20, 2025
Same
segressio commentedon Jun 21, 2025
How can I fix this? only useSubscription doesn't work, but query and mutation do.
colmer commentedon Jun 25, 2025
Works for me
~/plugins/vue-apollo.ts~/pages/index.vuejavi-code commentedon Jul 1, 2025
Someone found a solution ?
wuyuedefeng commentedon Sep 3, 2025
useSubscription not work, when can resolve?
adamwgriffin commentedon Sep 10, 2025
I was able to solve this issue simply by installing
@vue/apollo-composableas a separate dependency in my Nuxt 4.1.1 project withnpm install @vue/apollo-composable. I read through past issues in this repo and noticed that@vue/apollo-composablehas come up as an issue multiple different times, for example: #639 and #550 (comment). The version of@vue/apollo-composablethat I installed appears to be the same version that is provided by@nuxtjs/apollo(4.2.2), so I'm not entirely sure why this helps, but I've tested multiple times now, and it seems to be a good workaround.I also tried @colmer's solution by adding a plugin for Apollo and that worked well too, but I no longer needed it after installing
@vue/apollo-composable.Hope this helps as a workaround for anyone else that was struggling with this like I was.
Workaround for nuxt/apollo