@apollo/gateway doesn't work with apollo-server-lambda since 0.9.0
See original GitHub issue- Package:
@apollo/gateway
- Version: since
v0.9.0
- Last known working version:
v0.8.2
The server crashes with “Error: Expected undefined to be a GraphQL schema” when using new gateway version with apollo-server-lambda.
If you call gateway.load()
manually and pass the schema and executor to the ApolloServer constructor, you get “Error: Apollo Server requires either an existing schema, modules or typeDefs”
Here’s a minimal reproducible example:
import { ApolloServer } from 'apollo-server-lambda';
import { ApolloGateway } from '@apollo/gateway';
const gateway = new ApolloGateway({
serviceList: [
{ name: 'service-a', url: 'http://localhost:4001' },
],
});
const server = new ApolloServer({
gateway,
introspection: true,
playground: true,
subscriptions: false,
context: ({ event, context }) => ({
headers: event.headers,
functionName: context.functionName,
event,
context,
}),
});
exports.graphqlHandler = server.createHandler({
cors: {
origin: '*',
credentials: true,
methods: 'GET, POST',
allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept, Authorization',
},
});
Here’s what changed between the versions: b0a9ce0…99f78c6 (from a preliminary look gateway.load()
seems to be the change that causes the issue).
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Need help - Updating the apollo gateway from 0.26.1 to 2.0.0
After deploying I got this exception “TypeError: this.node is not a ... update issue”, I have updated the version of graphql to 16.0.0....
Read more >apollo-server-lambda | Yarn - Package Manager
Apollo Server is a community-maintained open-source GraphQL server that works with many Node.js HTTP server frameworks. Read the docs. Read the CHANGELOG.
Read more >apollo-server-lambda - CodeSandbox
Saeris/Apollo-Server-Lambda-CodeSandbox-Template. This Sandbox is in sync with master on GitHub. You have to fork to make changes
Read more >How to Build a Serverless Apollo GraphQL Server with AWS ...
Let's build a serverless Apollo Server and deploy to AWS Lambda!
Read more >apollo-server-lambda - npm
Production-ready Node.js GraphQL server for AWS Lambda. Latest version: 3.11.1, last published: 2 months ago.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@trevor-scheer Any updates on this issue?
@nihalgonsalves thank you for the great issue report and reproduction. I’ve confirmed the bug (and also confirmed it doesn’t happen for
apollo-server-express
).I’ll get back to this issue with an update within the week - I’ll need to do some digging and probably pick @abernix 's brain in order to understand what might be going on here, as I’m wholly unfamiliar with lambda. In the meantime, any results of further debugging on your end would be welcomed!