How best to upgrade Lambda functions from Node 12 to Node 16?
See original GitHub issueBefore opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
yarn
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
9.2.1
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No. I’m trying to avoid making any when upgrading to Node 16 in all my Lambda’s. I’m worried any changes will just get over-written when I next deploy anyway hence asking here 😃
Amplify Categories
function
Amplify Commands
push
Describe the bug
Got an email this week reminding me that I’m still running some early functions on Node 12, this is going to be retired in November so I need to change the environment that they are running on to be Node 16.
I used this lovely little one line in a console to get a list of all the functions in question (taken from the email, thank you):
aws lambda list-functions --function-version ALL --region us-east-1 --output text --query "Functions[?Runtime=='nodejs12.x'].FunctionArn"
Obvs change the region to match the one you are using.
I found some older docs on how to do this upgrade from Node 8 to Node 10 (https://docs.amplify.aws/cli/migration/lambda-node-version-update/) but we don’t seem to have an updated version for Node 12 to Node 16. Is there going to be one? Could we get one created?
Expected behavior
The docs at https://docs.amplify.aws/cli/migration/lambda-node-version-update/ include a section on how to update from Node 12 to Node 16 in a manner that Amplify won’t over write any changes on the next deploy.
I could try to follow the Node 8 upgrade path but not sure if anything differs (its not something I do regularly).
Reproduction steps
Well, not sure really, have a Lambda setup to run with Node 12 and try to upgrade it?
GraphQL schema(s)
# Put schemas below this line
Project Identifier
No response
Log output
# Put your logs below this line
Additional information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:13
- Comments:13 (3 by maintainers)
Note for fix: it would be nice to have a
amplify migrate function
command to auto-migrate runtimes without the need for a string replace in the function’s CloudFormation templateDirectly in AWs Console panel.
Those functions stay although you deleted the amplify app, normally 4 for each amplify app are created. I mean i have 5 amplify apps created, and i updated 32 lambdas from 12.x to 16.x manually, but i can’t identify to wich app it belongs to
Add this filter in lambda to find them