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
83
votes
15 answers

GraphQL gql Syntax Error: Expected Name, found }

I'm attempting to set up Apollo GraphQL support in a new React project, but when I try to compile a query using gql I keep receiving the error: Syntax Error: Expected Name, found } This is generated by the following code: import gql from…
Nathan
  • 1,897
  • 2
  • 15
  • 16
71
votes
4 answers

ActiveMQ vs Apollo vs Kafka

I don't have any previous experience with *MQs and I'm looking to build knowledge on JMS and message queues in general. That way, I wonder whether I should start with ActiveMQ or just "ignore" it altogether and start by teaching myself Apollo. Is…
Martin
  • 1,317
  • 3
  • 13
  • 18
67
votes
1 answer

GraphQL: Non-nullable array/list

I'm learning GraphQL now and while walking through tutorial I met behavior that I can't understand. Let's say we have defined type in schema: type Link { id: ID! url: String! description: String! postedBy: User votes: [Vote!]! } Due to…
DefLee
  • 685
  • 1
  • 5
  • 6
64
votes
5 answers

How do you prevent nested attack on GraphQL/Apollo server?

How do you prevent a nested attack against an Apollo server with a query such as: { authors { firstName posts { title author { firstName posts{ title author { firstName …
jboothe
  • 1,043
  • 1
  • 11
  • 15
61
votes
15 answers

UnhandledPromiseRejectionWarning: Error: You must `await server.start()` before calling `server.applyMiddleware()` at ApolloServer

I am trying to start my nestJs server and It keeps giving me this error: UnhandledPromiseRejectionWarning: Error: You must await server.start() before calling server.applyMiddleware() at ApolloServer I'm not even sure where to debug from as I am…
Boladek
  • 611
  • 1
  • 4
  • 4
60
votes
2 answers

Date and Json in type definition for graphql

Is it possible to have a define a field as Date or JSON in my graphql schema ? type Individual { id: Int name: String birthDate: Date token: JSON } actually the server is returning me an error saying : Type "Date" not found in…
Mohamed Taboubi
  • 6,663
  • 11
  • 55
  • 87
55
votes
9 answers

Why I got error: Cannot query field xx on type "Query"?

Although I copied and pasted the graphQL query from the GraphiQL tool after I tested it at GraphiQL successfully , the query returned with an error when I tried it in Apollo client within a reactJS app: [GraphQL error]: Message: Cannot query field…
simo
  • 23,342
  • 38
  • 121
  • 218
54
votes
6 answers

GraphQL dynamic query building

I have a GraphQL server which is able to serve timeseries data for a specified source (for example, sensor data). An example query to fetch the data for a sensor might be: query fetchData { timeseriesData(sourceId: "source1") { data { …
Matt Wilson
  • 8,159
  • 8
  • 33
  • 55
47
votes
3 answers

Apollo/GraphQL field type for object with dynamic keys

Let's say my graphql server wants to fetch the following data as JSON where person3 and person5 are some id's: "persons": { "person3": { "id": "person3", "name": "Mike" }, "person5": { "id": "person5", "name": "Lisa" …
Andru
  • 5,954
  • 3
  • 39
  • 56
44
votes
11 answers

React Apollo - Make Multiple Queries

I have a queries file that looks like this: import {gql} from 'react-apollo'; const queries = { getApps: gql` { apps { id name } } `, getSubjects: gql` { subjects { id name …
user2465134
  • 8,793
  • 5
  • 32
  • 46
42
votes
11 answers

Apollo client: How to simply debug a 400 code error?

I'm using Apollo-client and I don't understand why this is so hard to debug my error: I'm trying to perform a mutate call on my graphene python implementation of GraphQL. It end up with a 400 error code, and I have no way to retrieve the info. For…
Mr Bonjour
  • 3,330
  • 2
  • 23
  • 46
39
votes
4 answers

What is the difference between useQuery and useLazyQuery in Apollo graphQL?

I was going through the documentation of Apollo React hooks. And saw there are two queries hooks to use for which is useQuery and useLazyQuery I was reading this page. https://www.apollographql.com/docs/react/api/react/hooks/ Can someone explain me…
Lionel George
  • 401
  • 1
  • 4
  • 7
38
votes
7 answers

React Apollo Error: Invariant Violation: Could not find "client" in the context or passed in as an option

I'm building a project using React, Apollo and Next.js. I'm trying to update react-apollo to 3.1.3 and I'm now getting the following error when viewing the site. Invariant Violation: Could not find "client" in the context or passed in as an option.…
Keith
  • 418
  • 1
  • 4
  • 8
37
votes
1 answer

How to remove the `__typename` field from the graphql response which fails the mutations

I tried changing the addTypeName: false in the Apollo client in GraphQL apollo.create({ link: httpLinkWithErrorHandling, cache: new InMemoryCache({ addTypename: false }), defaultOptions: { watchQuery: { fetchPolicy: 'network-only', …
Rigin Oommen
  • 3,060
  • 2
  • 20
  • 29
35
votes
5 answers

How to load a .graphql file using `apollo-server`?

I am currently loading the GraphQL schema using a separate .graphql file, but it is encapsulated within strings: schema.graphql const schema = ` type CourseType { _id: String! name: String! } type Query { courseType(_id: String):…
Sam Sverko
  • 1,480
  • 4
  • 15
  • 32
1
2 3
99 100