The aws-sdk-v3 and NodeJS 18 has many benefits in terms reducing package size significantly and 75% increased performance as listed in AWS article.
The Node.js 18.x runtime was promoted to Active Long Term Support (LTS) on October 25th, 2022, and is now available in AWS Lambda. The AWS SDK for JavaScript (v3) is included by default in AWS Lambda Node.js 18 runtime as a convenience for developers...
As of December 15th, 2020, the AWS SDK for JavaScript, version 3 (v3) is generally available. On October 19th, 2020, we published the Release Candidate (RC) of the AWS SDK for JavaScript, version 3 (v3). One of the major changes in the...
However serverless framework yet to support
runtime: nodejs18.x
“aws-sdk”: “^3.188.0”
I tried updating aws-sdk manually, it’s not allowing. Can we get some timeline for this?
5 Likes
sven
March 9, 2023, 11:27am
2
How are you packaging the code? esbuild or webpack?
@sven I’m facing the same problem. I’m using esbuild plugin.
Do you have any directions?
Adding the log message I am seeing on AWS so that others searching for a solution can find this discussion thread:
(node:340) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.
Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
3 Likes
Hey altieres, I was chatting with a guy in the Serverless Slack and he saw your comment. He wanted me to post this to you…
“they need this in their esbuild config exclude: ['@aws-sdk'],
since aws-sdk has changed from aws-sdk to @aws-sdk ”
I hope it helps!
FYI, the tutorial fails also.
I edited the serverless.yml
(which was generated by the serverless
command) and backed down to NodeJS 16.x and it was fine. The YAML file referencing NodeJS 18.x was generated by the serverless
command.
I got it working here.
provider:
runtime: nodejs18.x
I’m using serverless-esbuild to pack and deploy the lambdas.
custom:
esbuild:
external:
- "@aws-sdk/client-apigatewaymanagementapi"
- "@aws-sdk/client-cloudfront"
- "@aws-sdk/client-dynamodb"
....
I only need to add the latest “aws-sdk” v2, because some library uses it behind. I think that’s it X-Ray “aws-xray-sdk”