Getting Apollo Server to work beyond Hello World with AWS Lambdas today I learned a couple important gotchas
serverless graphql gotcha 1)
I'm not nearly as fluent with GraphQL yet as I thought I was.
Discovering that on a paid livestream is ... 😅
serverless graphql gotcha 2)
GraphQL uses POST requests for everything.
Make sure you enable them in serverless.yml
serverless graphql gotcha 3)
AWS returns authentication errors instead of saying "That endpoint doesn't exist or isn't configured"
Always a 🤦♀️ when you realize what's up
apollo graphql gotcha 4)
You MUST have a Query in your schema. I don't know if that's a GraphQL thing or an Apollo thing, but it throws an error if you just have mutations.
apollo graphql gotcha 5)
Every query and mutation MUST have a resolver.
apollo graphql gotcha 6)
Every resolver MUST exist in your schema.
gotchas 5 and 6 make quick testing and iteration difficult. You can't just comment out some code to see what's up.
Super annoy when you have to wait 2min for each deploy ☹️
serverless gotcha 7)
Remember to compile your code.
If you're writing TypeScript and you deploy and it looks like nothing changed, check that you ran `tsc` first.
Apollo Server + AWS Lambda == ❤️
Superb combination. Wonderful ergonomics.