Tag: apollo
-
How to add header in Apollo GraphQL : iOS
19 Hy I am working in a project with Apollo GraphQL method and its working fine. But now the client required for adding additional header with Apollo API’s. But after adding the header the API’s response return as unAuthorized. I am adding the header as, let apolloAuth: ApolloClient = { let configuration = URLSessionConfiguration.default //…
-
Add appsync as subgraph to apollo graphql supergraph
0 I have apollo supergraph created with two subgraphs working perfectly. I have used Rover commands to join subgraphs with supergraph. Now I’m trying to add appsync as a subgraph to my supergraph. I have changed in the appsync schema as required apollo. Using rover command i have joined appsync as subgraph. I’m able to…
-
Why I got error: Cannot query field xx on type “Query”?
57 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 “allStudents” on type “Query”., Location: [object Object], Path: undefined Here is…
-
GraphQL only select items of certain type from array
0 In my GraphQL API I have defined a course fragment with an array property lessons. Initially it only had lessons of type TextLesson. Later we added lessons of type VideoLesson as well. fragment TextLessonFields on TextLesson { title body } #fragment VideoLessonFields on VideoLesson { # title # videoUrl #} fragment CourseFields on Course…
-
How to use Apollo’s multiple useQuery() hooks in React
2 I need to use 2 queries in my file and I am writing them like so: const {loading, data } = useQuery(getCharactersQuery); const {loading, data} = useQuery(getSingleCharacterQuery); The problem is, they both have the same "loading" and "data" variables and I don’t see anywhere in the docs how can we have different ones. How…
-
Any way to only cache GOOD responses in data sources?
0 Is there any way in @apollo/datasource-rest to cache "good" responses from my rest api, i.e statuses 200 to 299. I read in the datasource-rest documentation (https://github.com/apollographql/datasource-rest/blob/main/src/HTTPCache.ts#L201) that "With a TTL override, only cache successful responses but otherwise ignore method and response headers" Does that mean that adding this to my dataSource: cacheOptions: { ttl:…
-
error TS2769: No overload matches this call, nothing works
-1 im facing some issues with my code. Currently im doing the Catstronaut, from the (Lift-Off II) GraphQL with Apollo Tutorial. But after i wanna restart my services (dev and server) im recieving those errors: It shows some Overloads 1 of 2 below you can find the whole Error message and a code snippet from…
-
How to set timeout to graphql-client
7 I’m trying to set timeout with prisma-labs/graphql-request. I’ve tried the way described here – https://github.com/prisma-labs/graphql-request/issues/103. const client = new GraphQLClient(config.url, { timeout: 30000, headers: { Authorization: `Bearer ${token}` } }) My compiler complains as timeout is not directly present in Options interface – https://github.com/prisma-labs/graphql-request/blob/master/src/types.ts#L7. Should I need to extend the Options interface to use…
-
How to serialize GraphQLEnum JSON in swift with Apollo version 1.3
0 I am trying to serialize data from a GraphQL Apollo request into JSON in order to decode into my swift model. However, when trying to serialize the data with an enum it fails. static func decodeUser(userJson:JSONObject)->UserQL?{ let decoder = JSONDecoder() print(userJson) guard let jsonData = try? JSONSerializationFormat.serialize(value: userJson) else { return nil } return…