Support for Nodejs18.x and aws-sdk-v3

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.

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

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”