Questions tagged [apollo-server]

Apollo Server is a GraphQL server for Express, Connect, Hapi and Koa, written in TypeScript

Apollo Server is a community-maintained open-source server.

It works with all Node.js HTTP server frameworks: Express, Connect, Hapi and Koa.

Useful links:

1540 questions
68
votes
3 answers

How do I add a description to a field in "GraphQL schema language"

I have a graphql schema, a fragment of which looks like this: type User { username: String! password: String! } In graphiql, there is a description field, but it always says "self-descriptive". How do I add descriptions to the schema?
derekdreery
  • 3,280
  • 4
  • 27
  • 38
33
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
  • 3,953
  • 3
  • 29
  • 42
30
votes
6 answers

How do I handle deletes in react-apollo

I have a mutation like mutation deleteRecord($id: ID) { deleteRecord(id: $id) { id } } and in another location I have a list of elements. Is there something better I could return from the server, and how should I update the…
derekdreery
  • 3,280
  • 4
  • 27
  • 38
26
votes
2 answers

Stitching secure subscriptions using makeRemoteExecutableSchema

We have implemented schema stitching where GraphQL server fetches schema from two remote servers and stitches them together. Everything was working fine when we were only working with Query and Mutations, but now we have a use-case where we even…
23
votes
1 answer

Why am I getting a "Cannot return null for non-nullable field" error when doing a mutation?

I'm trying my hand at (Apollo) GraphQL on the server side and have been having a probably silly issue. I'm trying to sign up a user, but keep getting the error shown in the linked image below. What is the problem? Ignore the very simple auth flow,…
Collins Orlando
  • 1,011
  • 4
  • 11
  • 20
22
votes
3 answers

How to create a nested resolver in apollo graphql server

Given the following apollo server graphql schema I wanted to break these down into separate modules so I don't want the author query under the root Query schema.. and want it separated. So i added another layer called authorQueries before adding it…
elbarto
  • 223
  • 1
  • 2
  • 7
20
votes
4 answers

Why does a GraphQL query return null?

I have an graphql/apollo-server/graphql-yoga endpoint. This endpoint exposes data returned from a database (or a REST endpoint or some other service). I know my data source is returning the correct data -- if I log the result of the call to the data…
Daniel Rearden
  • 58,313
  • 8
  • 105
  • 113
16
votes
7 answers

createReadStream() throwing RangeError: Maximum call stack size exceeded when uploading file

I am trying to use Apollo Server's Upload scalar to send files to S3 directly. My schema: const { gql } = require('apollo-server-express') module.exports = gql` extend type Mutation { createPicture( name: String! picture: Upload! ):…
W. Reyna
  • 594
  • 5
  • 19
15
votes
7 answers

Apollo GraphQL Server + TypeScript

I've been working on a project lately, which has node.js + express + typescript + Apollo server stack. And while researching on Apollo client, I've stumbled upon TypeScript section. But nothing like that was for server, which leaves me to freedom of…
naffiq
  • 890
  • 1
  • 7
  • 18
15
votes
3 answers

How to parse GraphQL request string into an object

I am running Apollo lambda server for GraphQL. I want to intercept the GraphQL query/mutation from the POST request body and parse it so I can find out which query/mutation the request is asking for. The environment is Node.js. The request isn't…
Nick Ramsbottom
  • 433
  • 1
  • 4
  • 16
15
votes
4 answers

Graphql-Access arguments in child resolvers

I am using apollo-server and apollo-graphql-tools and I have following schema type TotalVehicleResponse { totalCars: Int totalTrucks: Int } type RootQuery { getTotalVehicals(color: String): TotalVehicleResponse } schema { query:…
Manan Vaghasiya
  • 799
  • 10
  • 24
14
votes
1 answer

"Abstract type X must resolve to an Object type at runtime for field Query.user with value

this my code schema gql` type Query { user: X! } type User { name: String! } type Time { age: Int! } union X = User | Time `; resolvers { X: { __resolveType: obj => { if (obj.name) return { name: "Amasia" }; …
Jesus
  • 1,026
  • 2
  • 9
  • 24
14
votes
4 answers

apollo-server-express CORS issue

So I am migrating to apollo-server-express 2.3.3 ( I was using 1.3.6 ) I've followed several guides, making the necessary tweaks but am stuck in a CORS issue. According to the docs you have to use the applyMiddleware function to wire up the apollo…
José Del Valle
  • 521
  • 9
  • 25
13
votes
1 answer

Apollo Server timeout while waiting for stream data

I'm attempting to wait for the result of a stream with my Apollo Server. My resolver looks like this. async currentSubs() { try { const stream = gateway.subscription.search(search => { …
ToraRTC
  • 443
  • 1
  • 4
  • 15
13
votes
1 answer

How to combine a mutation and a query in a single query?

I have an operation getFoo that requires that the user is authenticated in order to access the resource. User authenticates using a mutation authenticate, e.g. mutation { authenticate (email: "foo", password: "bar") { id } } When user is…
Gajus
  • 55,791
  • 58
  • 236
  • 384
1
2 3
99 100