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:

2126 questions
7
votes
2 answers

Schema Stitching resolve conflict by adding prefix

So I have this two schemas Schema1 type Permission { relation: Relation } enum Relation { ONE TWO THREE } Schema2 type Permission { relation: Relation } enum Relation { FOUR FIVE SIX } The expect result is…
acrogenesis
  • 937
  • 9
  • 21
7
votes
1 answer

Add schema directive for all the queries in GraphQL

Is there a way to add a schema directive by overriding one of the methods of SchemaDirectiveVisitor for all the queries and mutations? For example to check the authentication token in a directive. Would be nice to add it just once not for every…
cosmarc
  • 562
  • 3
  • 19
7
votes
3 answers

"Variable \"$id\" of required type \"ID!\" was not provided."

I am trying to query by passing the variable id in the query variable window. This results in an error "Variable \"$id\" of required type \"ID!\" was not provided." When I run a different query without passing a variable in the query variable…
7
votes
2 answers

Header are not passed through after updating nestjs/graphql

I'm about to update my project dependencies to the next major versions but i can't get nestjs/graphql + nestjs/passport to work. It looks like the request header is not passed through apollo server. Everytime when passport tries to extract the…
w0wka91
  • 189
  • 2
  • 9
7
votes
2 answers

How to cache using apollo-server

The apollo basic example at https://www.apollographql.com/docs/apollo-server/features/data-sources.html#Implementing-your-own-cache-backend they state that doing a redis cache is as simple as: const { RedisCache } =…
Owen Allen
  • 11,348
  • 9
  • 51
  • 63
7
votes
2 answers

Graphql - Apollo Server - Hot update schema

I am looking to hot reload my GraphQL schema on my apollo-server-express server. Anyone would have any idea about how to do that? I'm currently using schemas stitching to gather multiple API's schemas, however I do not want to have to restart my…
7
votes
2 answers

GraphQL redirect when resolver throws error

I'm using graphql-server-express to build a GraphQL server that consumes a REST API. I'm in the situation that a REST call could return a 301 or 401 status code when the user isn't authenticated to access the resource. I'm using a cookie that is set…
amann
  • 5,449
  • 4
  • 38
  • 46
7
votes
1 answer

Apollo GraphQL: Multiple Queries in One Component?

I have a component that needs to query two entirely separate tables. What do the schema, query and resolver need to look like in this case? I've googled but haven't found examples yet. Thanks in advance for any info. UPDATE: On Slack I see there may…
VikR
  • 4,818
  • 8
  • 51
  • 96
6
votes
1 answer

Is there any option to disable playground when in production mode?

Is there any option in apollo v3 to disable playground when inside production mode? in v2 you could disable it by passing playground: false to ApolloServer options but can't find any in v3. Im using apollo-server-fastify. Edit: I have disabled…
Mj Ebrahimzadeh
  • 587
  • 9
  • 22
6
votes
1 answer

Is it possible to deploy apollo-server-express to lambda?

I have a backend project implemented with apollo-server-express. I researched how to deploy this to lambda and found that I need to use apollo-server-lambda for this. I am not familiar with GraphQL and AWS lambda. I don't know the differences…
user12688644
6
votes
1 answer

Jest mock method of base ES6 class (super method) when testing extended class

I am having issues when testing that the original method (from the base class), is called with some parameters, when testing an extended class. The class that I want to test is: // ApiDataSource.js import { RESTDataSource } from…
Albert Alises
  • 1,018
  • 1
  • 8
  • 19
6
votes
3 answers

Trouble migrating from graphql-import to just graphql-tools with ApolloServer, directives cease to work

My plight began as a simple desire to expand my graphql schema from a single .graphql file to multiple files so i can better organize the schema and so it wouldn;t grow to one huge file out of control. My original layout was very straight forward…
xunux
  • 1,531
  • 5
  • 20
  • 33
6
votes
1 answer

Processing an exception through Apollo Server (NestJS)

is there a way how to run an exception through the apollo exception handler manually? I have 90% of the application in GraphQL but still have two modules as REST and I'd like to unify the way the exceptions are handled. So the GQL queries throw the…
kuncajs
  • 1,096
  • 1
  • 9
  • 20
6
votes
2 answers

MongoError: Topology is closed, please connect

I'm a front-end dev trying to expand my horizons on a new Next project, learning Node, Mongo, and the server side of GraphQL for the first time. Apollo strikes me as the easiest way to jump in, as I've already used client-side Apollo on previous…
Teagan Atwater
  • 178
  • 1
  • 3
  • 10
6
votes
3 answers

How can I debug a memory leak on my Apollo GraphQL server?

I have a graphql server with multiple endpoints. It is basically just a CRUD app, so I'm honestly not sure why there's a memory leak. The only potentially leaky endpoint I have is one that uploads pics to S3. I've been looking around and have tried…
bigpotato
  • 26,262
  • 56
  • 178
  • 334