apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Apollo client not found

Open cory-mosey opened this issue 1 year ago • 2 comments

Environment

Describe the bug

Just upgraded to Nuxt 3.10 (Downgraded again due to this error hence the bug report above), but all my apollo queries, etc are now returning this:

Error: Apollo client with id default not found.

My config is set up as follows:

apollo: {
    clients: {
	default: {
	    httpEndpoint: process.env.URL,
	    defaultOptions: {},
	}
    },
}

Any reason as to why this is happening? Has Nuxt Apollo not been updated to Nuxt 3.10 yet?

Expected behaviour

Expected: Nuxt Apollo to find default client based on config as working in Nuxt 3.9.

Reproduction

No response

Additional context

No response

Logs

No response

cory-mosey avatar Mar 10 '24 20:03 cory-mosey

@cory-mosey could you upgrade to the current latest version (@5.0.0-alpha.13), and try again?

Diizzayy avatar Mar 11 '24 11:03 Diizzayy

@cory-mosey could you upgrade to the current latest version (@5.0.0-alpha.13), and try again?

I am using "@nuxtjs/apollo": "^5.0.0-alpha.14" and I am getting ypeError: Cannot read properties of undefined (reading 'query') error when I use the following function to fetch data

   async fetch() {
      try {
        const res = await this.$apollo.defaultClient.query({
          query: getEventsQuery,
          variables: {
            skip: this.skip,
            take: this.take
          }
        });

        if (res) {
          this.isLoading = false;
          const { results } = res.data.events;
          this.events = results;
        }
      } catch (err) {
        console.error(err);
        this.isLoading = false;
        this.events = [];
      }
    }

Besufikad17 avatar May 27 '24 20:05 Besufikad17