Today I just started using apollo-server-lambda. It works pretty well, and my GET request resulted in the GraphiQL playground showing. However, the POST method requests were all failing due to an error in the backend. I could see in Cloudwatch that there was an error when apollo-server-lambda/src/lambdaApollo does JSON.parse(event.body).
For one reason or another, my event had event.isBase64Encoded === true, and the event.body was a long base64 encoded string (that decoded to JSON), not a JSON string.
I was able to work around this error by rewriting all base64-encoed events upstream using this 'middleware' before passing the event into the apollo-lambda-server ApolloServer handler.
PR: #2600
Today I just started using apollo-server-lambda. It works pretty well, and my GET request resulted in the GraphiQL playground showing. However, the POST method requests were all failing due to an error in the backend. I could see in Cloudwatch that there was an error when apollo-server-lambda/src/lambdaApollo does
JSON.parse(event.body).For one reason or another, my event had
event.isBase64Encoded === true, and theevent.bodywas a long base64 encoded string (that decoded to JSON), not a JSON string.I was able to work around this error by rewriting all base64-encoed events upstream using this 'middleware' before passing the event into the apollo-lambda-server ApolloServer handler.
PR: #2600