Questions tagged [apollo]

Apollo is a GraphQL client and cache for JavaScript, iOS (Swift) and Android.

Apollo is a flexible, fully-featured client for every platform.

Apollo is made up of a family of technologies you can incrementally add to your stack: Apollo Client to connect data to your UI, Apollo Engine for infrastructure and tooling, and Apollo Server to translate your REST API and backends into a GraphQL schema.

It has implementations for JavaScript, iOS and Android. The JavaScript client has integrations for React, Angular, Vue.js, Ember.js and more.

Apollo is fully compatible with any server that implements the GraphQL specification.

4536 questions
10
votes
0 answers

Apollo v3 unable to reach server

I am trying to deploy my basic apollo server to aws ec2 instance but i am facing with "Unable to reach server Network requests from Studio on HTTPS to your HTTP endpoint are not secure, so we cannot introspect your endpoint." So what should i do ?
10
votes
1 answer

How do I reset the useMutation hook of Apollo Client

I am developing a React form that's tied to a GraphQL mutation using the useMutation of Apollo Client. On the server, I perform some validation and in case of errors, I reject the mutation. On the client-side, I use the error object to receive the…
Martin Devillers
  • 17,293
  • 5
  • 46
  • 88
10
votes
4 answers

Apollo GraphQL merge cached data

I have a page that consists of 2 components and each of them has its own request for data for example const GET_MOVIE_INFO = `gql query($id: String!){ movie(id: $id){ name description } }` Next…
Thomas Rositsky
  • 177
  • 1
  • 3
  • 10
10
votes
1 answer

Testing TypeScript with Jest: "no overload matches this call"

I'm working on testing an Apollo Server RESTDataSource using Jest. My app is written in TypeScript. My class, CDCDataSource extends the abstract class RESTDataSource which itself extends the abstract class DataSource. RESTDataSource has the…
Cerulean
  • 5,543
  • 9
  • 59
  • 111
10
votes
3 answers

How do you mock an Apollo Server RESTDataSource for unit testing with Jest?

I'm trying to test a data source in my Apollo Server that based on Apollo Server's RESTDataSource (https://www.apollographql.com/docs/apollo-server/data/data-sources/#rest-data-source). I'm trying to test it using Jest. The class has methods that…
Cerulean
  • 5,543
  • 9
  • 59
  • 111
10
votes
2 answers

apollo's MockedProvider doesn't warn clearly about missing mocks

I'm making unit tests for React components using apollo hooks (useQuery, useMutation), and in the tests I mock the actual queries with apollo's MockedProvider. The problem is that sometimes, my mock doesn't match the query actually made by the…
Quentin
  • 1,085
  • 1
  • 11
  • 29
10
votes
2 answers

GraphQL to query something other than ID

I am using Strapi with Nuxt.js to implement my first Headless CMS. I am using Apollo and GraphQL. I am running into the current error and I've had no luck to figure this out for days. If I write: query Page($id: ID!) { page(id: $id) { id …
Saro
  • 529
  • 1
  • 7
  • 19
10
votes
2 answers

how to use enum in apollo-client?

the enum define in OrderTypesEnum.gql enum OrderTypes { full_buy pink_buy } import OrderTypesEnum.gql file import OrderTypes from '@/graphql/OrderTypesEnum.gql'` but, How to get enum in code ? I use OrderTypes.full_buy get some error: …
lidashuang
  • 1,975
  • 4
  • 20
  • 22
10
votes
1 answer

refetching a query with react-apollo: why is `loading` not true?

I'm trying Apollo and using the following relevant code: const withQuery = graphql(gql` query ApolloQuery { apolloQuery { data } } `); export default withQuery(props => { const { data: { refetch, loading, apolloQuery }, } = props; …
Silly Freak
  • 4,061
  • 1
  • 36
  • 58
10
votes
3 answers

Nuxt JS Apollo data only available after page refresh

I am fetching some data using Apollo inside of Nuxt. Somehow, when navigating to that page I get an error of Cannot read property 'image' of undefined When I refresh the page, everything works as expected. I have a found a few threads of people…
Martin Conde
  • 345
  • 3
  • 15
10
votes
0 answers

Apollo Client Chrome Devtools Cache Empty with Angular

I have an Apollo Angular Client application. I write to the store: const userQuery = this.userGql.document; this.apollo.getClient().writeQuery({ query: userQuery, data: { user: result.data.login.user }, }); This works. I then retrieve the user…
Diesel
  • 5,099
  • 7
  • 43
  • 81
10
votes
1 answer

Error: Network error: Error writing result to store for query:

Getting this error from Apollo: core.js:14576 ERROR Error: Network error: Error writing result to store for query: …
MCMatan
  • 8,623
  • 6
  • 46
  • 85
10
votes
2 answers

GraphQL: Nested queries vs root queries

I'm using Apollo GraphQL on my server, and I'm trying to design my GraphQL API. One question I'm having is whether I should prefer nested queries over root queries or not. Let's examine both in this example where the current user, me, has many…
nomadoda
  • 4,561
  • 3
  • 30
  • 45
10
votes
4 answers

How can I use express middleware with only Apollo Server 2 graphql endpoints

I want to use morgan's tiny log statements for all of my routes, except graphql endpoints. I'm using express and Apollo 2, and have not been able to get middleware working with express. As the code sample shows, I can install middleware for the…
Jared Dykstra
  • 3,596
  • 1
  • 13
  • 25
10
votes
4 answers

apollo graphql UI is not updating after refetch

In a react login component, I'd like to refetch and update the navbar component once login is successful. const loginUser = () => { props.mutate({ variables: { input: { email, password }, }, refetchQueries: [{ query:…
leogoesger
  • 3,476
  • 5
  • 33
  • 71