Closed jepetko closed 1 month ago
Hi @jepetko ,
the aws-lambda
package is not related to the AWS SDK. The aws-sdk/client-lambda
package is a control plane API that lets you create, update, and invoke your lambda function. I'm not too familiar with aws-lambda
package, but this is not a part of the AWS SDK, and therefore should not be related to the JS SDK's migration from v2 to v3. AFAIK aws-lambda
is the client for the data-plane API of lambda, and is mainly revolving exposing types that you can use in your code which should be SDK version agnostic.
Is there anything specific stopping you from using the aws-lambda
package with v3?
Thanks, Ran~
Hi @RanVaknin !
thank you for the answer!
Which npm package do you mean by aws-lambda
? Do you mean @types/aws-lambda
? https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda
What I realized now is when I migrated to v3 ("@aws-sdk/*": "^3.*.*"
), I removed both, "aws-sdk": "^2.*.*"
and "@types/aws-lambda": "^*.*.*"
in the expectation that the types will be served by @aws-sdk/*
.
So the way to go is to take the types unrelated to the internal implementation of aws-sdk (such as events coming from SQS, API GW etc.) from @types/aws-lambda
, correct?
Thanks!
Hi @jepetko ,
Which npm package do you mean by aws-lambda? Do you mean @types/aws-lambda? https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda
I'm referring to the imports shared in your initial code:
import {APIGatewayProxyEvent, APIGatewayProxyResult, Context} from 'aws-lambda';
@types/aws-lambda
is not a package maintained by AWS and has nothing to do with the SDK therefore it should not be related to the migration between v2 and v3. If there is an issue with the compatibility with v3, I suggest you open an issue on that repo, since the SDK only officially supports AWS packages and not 3rd party tools.
My guess is that there is no issue and you can safely re-introduce those imports since they just seem like type definitions and should be safe to use regardless of SDK version.
All the best, Ran~
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Describe the issue
(Note that this question was posted in "Discussions" more than 1 year ago and is unanswered until now, see https://github.com/aws/aws-sdk-js-v3/discussions/4572. Thus, I am re-posting it as a documentation issue.)
Dear colleagues,
I am struggling with finding the counterpart event types in the new implementation. I want to import types in lambda handlers such as
but I am not able to find it anywhere. Please can you provide more information about the proper typings for lambda invocations and other types of events?
I also hope to get some feedback on how I migrated
DynamoDBStream
andCloudWatch
events, as it took me long to find it and I am even not sure it is correct.For example, I migrated DynamoDB Stream event like this as the type has the same structure:
exports.onDbEvent = async (evt: GetRecordsOutput) => { // .... };
Could you provide information about where to find all those types? As a workaround, I copied the types from the old implementation which I would like to remove.
Thank you.
Links
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/lambda/