apollo-server-integrations / apollo-server-integration-aws-lambda

An integration to use AWS Lambda as a hosting service with Apollo Server
MIT License
46 stars 9 forks source link

createAPIGatewayProxyEventV2RequestHandler() not working properly #77

Closed Lucifer0x17 closed 1 year ago

Lucifer0x17 commented 1 year ago

image

I am getting the response if I am using createAPIGatewayProxyEventRequestHandler() handler but if I am using V2 handler I am getting statusCode of 400

Lucifer0x17 commented 1 year ago

Apologies for a messed up screenshot. Here is a better view image

mxmcg commented 1 year ago

I found that updating my query.json file to below did the trick. (requestContext)

{
  "version": "1",
  "httpMethod": "POST",
  "path": "/",
  "headers": {
    "content-type": "application/json"
  },
  "requestContext": { "http": { "method": "POST" } },
  "rawQueryString": "",
  "body": "{\"operationName\": null, \"variables\": null, \"query\": \"{ hello }\"}"
}

I believe the issue lies in https://github.com/apollo-server-integrations/apollo-server-integration-aws-lambda/blob/main/src/request-handlers/APIGatewayProxyEventV2RequestHandler.ts#L14

And perhaps the documentation needs to be updated in https://github.com/apollographql/apollo-server/pull/7291/files

mxmcg commented 1 year ago

FYI a PR is opened for this issue on @as-integrations/aws-lambda https://github.com/apollographql/apollo-server/issues/7327#issuecomment-1405083773

Lucifer0x17 commented 1 year ago

Ohh okay. Thank you so much. I will close the issue then. Thanks.