Closed sterankin closed 55 minutes ago
@sterankin Good morning. Could you please confirm if you are using CDK or @types/aws-lambda? This repository is for AWS CDK. We do not maintain @types/aws-lambda. Kindly open the issue in the right repository https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda.
Thanks, Ashish
@ashishdhingra I am using CDK to build and deploy the API Gateway and associated integrated lambdas.
I am using the LambdaIntegration from aws-cdk-lib/aws-apigateway.
import { Code, Function, FunctionProps, Runtime } from 'aws-cdk-lib/aws-lambda'; import { LambdaIntegration, MethodLoggingLevel, MethodOptions, Period, TokenAuthorizer, } from 'aws-cdk-lib/aws-apigateway';
@ashishdhingra I am using CDK to build and deploy the API Gateway and associated integrated lambdas.
I am using the LambdaIntegration from aws-cdk-lib/aws-apigateway.
import { Code, Function, FunctionProps, Runtime } from 'aws-cdk-lib/aws-lambda'; import { LambdaIntegration, MethodLoggingLevel, MethodOptions, Period, TokenAuthorizer, } from 'aws-cdk-lib/aws-apigateway';
@sterankin Thanks for you response. In the code snippet that was shared in issue description, it's a lambda handler which uses @types/aws-lambda, with no reference to CDK. Could you please share end-to-end self-contained minimal reproduction code to troubleshoot the issue?
Referring to Define Lambda function handler in Node.js, looks like you are using callback version of Lambda handler.
Also, what is the Lambda runtime you are targeting. Latest Lambda runtimes come bundled with AWS SDK for JavaScript v3, so most likely this the the Lambda runtime issue, which might be enforcing async pattern. May be you should try opening the issue in AWS SDK for JavaScript repo here!
Thanks, Ashish
Thanks will try there
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.
Describe the bug
When using the API Gateway Lambda Integration, the function errors at the API Gateway with a 502 error, unless the function is an async function.
cdk version: "aws-cdk-lib": "^2.147.3",
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Expect the valid lambda response to be accepted by the api gateway.
Current Behavior
Api Gateway Logs for the non-async function:
Reproduction Steps
Simple GET on an API Gateway fails
However this works:
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
n/a
Framework Version
No response
Node.js Version
18
OS
n/a
Language
TypeScript
Language Version
No response
Other information
No response