I'm running into an Error running this plugin with a serverless setup as follow:
functions:
api:
handler: graphql.graphqlHandler
events:
- http:
path: graphql
method: POST
cors: true
integration: lambda
- http:
path: graphql
method: GET
cors: true
integration: lambda
There seems to be missing a proper handling of API-Gateway + Lambda setup.
Can you post some code to reproduce the problem. I have not tested it with serverless but it should work as expected.
What error are you getting? Is it in cloudwatch or with serverless deploy?
Taking a look at your config you might be using the incorrect integration. Delete the line integration: lambda as the default is lambda proxy and you have it set to lambda, which I don't think are the same.
You can also explicitly set integration: lambda-proxy as that should work as well.
Nice! That seems to have fixed it for me. Maybe you could add that to your example cloudformation config. This would have saved me hours of frustration. 馃憤
I will add another example for serverless as it seems to be the more popular choice.
You can use mine if you want:
functions:
api:
handler: graphql.graphqlHandler
events:
- http:
path: graphql
method: POST
cors: true
integration: lambda-proxy
- http:
path: graphql
method: GET
cors: true
integration: lambda-proxy
graphqli:
handler: graphql.graphiqlHandler
events:
- http:
path: graphiql
method: GET
cors: true
lambda-proxy is the default so you shouldn't need to explicitly add that.
Most helpful comment
lambda-proxy is the default so you shouldn't need to explicitly add that.