-
Notifications
You must be signed in to change notification settings - Fork 996
lambda-sqs-terraform: Update runtime to nodejs22.x #2813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -2,7 +2,7 @@ terraform { | |||
required_providers { | |||
aws = { | |||
source = "hashicorp/aws" | |||
version = "~> 4.22" | |||
version = "~> 5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Older version does not support Node.js 22 runtime. So I updated the version to v5.
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: The following error occurs. Because in Node.js 18 and later runtimes, AWS SDK v3 is bundled, so I rewrote it to v3. See articles below.
- https://aws.amazon.com/blogs/compute/node-js-18-x-runtime-now-available-in-aws-lambda/
- https://aws.amazon.com/blogs/compute/node-js-22-runtime-now-available-in-aws-lambda/
{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/app.js\n- /var/runtime/index.mjs","trace":["Runtime.ImportModuleError: Error: Cannot find module 'aws-sdk'","Require stack:","- /var/task/app.js","- /var/runtime/index.mjs"," at _loadUserApp (file:///var/runtime/index.mjs:1109:17)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1148:21)"," at async start (file:///var/runtime/index.mjs:1332:23)"," at async file:///var/runtime/index.mjs:1339:1"]}%
role = aws_iam_role.lambda_iam_role.name | ||
policy_arn = aws_iam_policy.lambda_policy.arn | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue #, if available:
N/A
Description of changes:
Hi😀 Thanks for the useful patterns!
To prevent future deployment issues, I updated the Lambda Node.js runtime version to
nodejs22.x
.While testing
lambda-sqs-terraform
, I noticed that the Lambda runtime versionnodejs16.x
was deprecated. Although it's still deployable at the moment, it will not be allowed after October 1, 2025.https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
Check
terraform apply
completed successfully and works good.Thank you😀
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.