Internal server error but no logs?
Wiring up a Lambda function to API Gateway takes a few steps. If you miss one the route to your function won’t be complete and API Gateway will drop your request (or message if you’re using WebSockets).
Make sure you do all of these steps:
- Create a Lambda function (in CDK’s Lambda module this is
new Function(...) which requires: idan identifier for the functionFunctionPropsthe properties used to build the function- Create an integration (in CDK’s API Gateway v2 module this is
new CfnIntegration(...) which requires: apiId- in CDK it isapi.refif thenew CfnApi(...call’s result was stored in a variable calledapiintegrationType- usuallyAWS_PROXYintegrationUri- an API Gateway ARN that contains the ARN of the Lambda function it is using like thisarn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:512341234123:function:myfunction-EB2081F1-4R5RskdFGSYU/invocationscredentialsArn- the ARN of a role that can be assumed by the service principalapigateway.amazonaws.com- Create a route (in CDK’s API Gateway v2 module this is
new CfnRoute(...step) which requires: apiId- same as aboverouteKey- which is the path that API Gateway should use to filter requests/messages for this integrationauthorizationType-NONEfor no authorization, but there are many other optionstarget- in TypeScript CDK it isintegrations/${integration.ref}if thenew CfnIntegration(...call from above was stored in a variable calledintegration
If that doesn’t work make sure you have API Gateway logging turned on and see if your requests are getting routed to another integration.