today, when i tried to update one of my functions with:
sls deploy -f myFunction --config serverless-system.yml
i got: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions
i have updated my yaml to:
runtime: nodejs18.x
but it still dosnt let me update my function.
when changing the runtime in the aws website it let me update the function but after the update i get:
Runtime.ImportModuleError: Error: Cannot find module ‘aws-sdk’"
in my yaml i have:
webpack:
forceInclude:
- aws-sdk
my questions are:
how to update a single function runtime through the cli?
how to fix the aws-sdk error ?
In general, is there any breaking changes between Node 18 and Node 12, disregarding external packages?
I don’t remember all of the changes but they did switch the AWS SDK from v2 to v3. You might want to try using nodejs14.x or nodejs16.x to get away from 12 then do a proper upgrade when you have time.
yes, but how to do that not through the aws web console ?
I mean, for one function it’s ok, but i am updating functions all the time.
is there a way to update the run time of all the functions without publish a new version of the functions?
then it will give me to update every function i want whenever i want.
If you deployed the functions using Serverless then you should update them using Serverless. Doing it through the console will cause your CloudFormation stacks to be out of sync with your AWS account and can cause problems later.