I want to use Lambda with the event sources SQS & API Gateway with SDKv3 and without a SDKv2 dependency
ehuebner opened this issue · 3 comments
Describe the bug
I want to use Lambda in my Typescript / NodeJs application. I am using SQS and API Gateway as event sources.
As the documentation mentions, I need to install aws-lambda
to get the type definitions for APIGatewayProxyEvent
, APIGatewayProxyResult
, SQSEvent
& SQSRecord
.
aws-lambda
has dependency to the SDKv2 and as a result I have the 100 mb SDKv2 in my dependencies only because I need the 4 type definitions. With a 256mb layer size and dependencies I need for my use case, I exceed the 256mb.
Expected Behavior
Have type definitions of all Lambda event sources available without a dependency to SDKv2.
Current Behavior
Lambda event source type definitions have a dependency to SDKv2.
Reproduction Steps
npm install aws-lambda
Check your package-lock.json
or your node_modules
directory for aws-sdk
.
Possible Solution
Provide the interfaces in the SDKv3.
Additional Information/Context
No response
SDK version used
v3 & forced to use v2
Environment details (OS name and version, etc.)
MacOS
Hi @ehuebner ,
Thanks for reaching out.
Despite its name, aws-lambda
is not a tool owned by AWS. This is a community driven repo, and we don't control it.
I do see that you can install the types themselves: npm install --save @types/aws-lambda
, or your other option is to create those interfaces yourself in your lambda function.
Since this is not actionable by the AWS SDK team, I'm going to go ahead and close this.
Thanks again,
Ran~
@RanVaknin could you please explain if there is a better alternative? it seems to me like these types should just exist in the v3 sdk somewhere. For DynamoDB event streams, we can access the type definition from @aws-sdk/client-dynamodb-streams
. why is there not an equivalent @aws-sdk/client-sqs-streams
or whatever? This seems like an oversight to me when the claim of v3 is to be typed.