It looks to me like this is the core issue, as you have identified. Serverless Framework does not yet support AWS SDK v3. Lambda requires us to use SDK v3 in order to use nodejs 18 or higher (nodejs 20 is available now). So we Serverless/Lambda users are stuck on nodejs 16 for now.
It is understandable that it will take some time for Serverless to do it right, however. From what I am reading it looks like the modularity and usage of layers in Lambda are quite different. So all the code that executes when we do serverless deploy will have to change fairly dramatically.
Can we get a statement of intent or timeframe estimate from anyone about support sdk v3?
Okay gang, I jumped into the Serverless Slack and discussed this problem with a super helpful guy there. He helped me understand that there really is no inherent connection between serverless and aws-sdk. So you can continue using aws-sdk v2 while increasing the provider/runtime to nodejs18.x in serverless.yml. The key is that you have to make sure that aws-sdk is installed as a dependency rather than as a devDependency. You can do this nice and safely by doing this:
npm uninstall aws-sdk
npm install aws-sdk
That was all I needed, and then I could go into serverless.yml and go to provider: runtime and upgrade from nodejs16.x to nodejs18.x. Now Iām running serverless with nodejs18 in AWS Lambda.
The whole issue of upgrading serverless to aws-sdk v3 is a separate issue because when following this path we are packaging up aws-sdk v2 with our code and loading it all into Lambda. Eventually sure it would be nice to not have to package aws-sdk v3 but serverless is not there yet. Also it looks like there will be some breaking code changes when we get there. Nothing horrible but must focus on it. This article has info on that when you are ready for it:
But Iām not going to approach it until serverless approaches it for me.
Hi, I have tried as you mentioned, now downgraded to aws sdk version 2 from version 3 and trying to use nodejs 18 runtime in provider in serverless.yml but getting error as āfound unsupported runtime nodejs18.xā. I want to use nodejs 18 as runtime in serverless framework..
Also, could you please tell me what is the serverless version you are using to support nodejs 18 runtime and aws sdk version 2.
Sharing my version
āaws-sdkā: ā^2.943.0ā, (tried latest version as well for version 2 - 2.140.0) āserverlessā: ā^2.60.0ā, āserverless-gulpā: ā^1.0.9ā, āserverless-offlineā: ā^8.6.0ā, āserverless-webpackā: ā^5.3.3ā,
Getting this error while running serverless offline --stage=stage offline: GET /stage/inspection/get_auction_codes (Ī»: inspection_getAuctionCodes)
offline: Warning: found unsupported runtime ānodejs18.xā for function āinspection_getAuctionCodesā offline: Failure: Unsupported runtime Error: Unsupported runtime
Hi, As you said I have upgraded serverless till 3.32.2 also downgraded aws sdk till version 2 and using nodejs 18 as a runtime provider. Every thing was looking fine initially but now getting some issue in lambda while calling as below.
**Uncaught exception ** error The security token included in the request is invalid
We have identified this issue seems coming from serverless. we did some syntax level changes as well like * provider.role ā provider.iam.role but still not working and issue is coming.
Sharing some similar thread I found on internet
Here I am using role base acces so not using aws access and secret key.
Could you please help me out how to fix it?
Sorry to hear of your trouble! I donāt have any specific experience with this error, sorry. But I would say the best possible thing you can do is use the ādivide the lineā approach to debugging. This means:
Back out changes and get back to a known-good state
Skillfully determine which changes are 50% between this known-good state and the broken state, and re-introduce only those changes, and then test.
Loop this previous step over and over, and it should take you no more than 7 iterations to solve even the most difficult of bugs.
If it takes you more than 7 tries that means you are not selecting the 50% point correctly.
This has ALWAYS worked for me over 25+ years of hard core software development.
@gourabb8273 I am facing below issue
nodejs18.xā
I have changed from 14 to nodejs 18 as runtime in serverless framework.
Getting unsupported runtime.also ihave updated all my serverless dependencies including aws-sdk to v3 .
can you suggest how to resolve this.