Skip to content
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

feat(aws-rfdk): update Lambda functions to use Node.js 18 #1224

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

rondeau-aws
Copy link
Contributor

@rondeau-aws rondeau-aws commented Aug 6, 2024

Problem

The RFDK's Lambda functions use Node.js 16, which was deprecated on June 12, 2024.

Solution

Update the Lambda functions to use Node.js 18.

Also:

  • Previously, the Lambda functions used the AWS SDK for JavaScript v2. This is no longer included in the runtime environment for Node.js 18, so we updated the Lambdas to use the v3 SDK.
  • Previously, we tested the Lambda's AWS SDK calls using aws-sdk-mock. However, this library doesn't support the AWS SDK for JavaScript v3, so we changed our tests to use aws-sdk-client-mock which does.
  • The ExportingLogGroup Lambda was failing with errors such as "InvalidParameterException: Specified time range of '1723036552256' and '1722953812215' is not valid. Please make sure the values are within the retention period of the log groups and from value is lesser than the to value". To fix this, I changed the implementation to calculate the time range using milliseconds instead of using Date.

Testing

I tested the Lambdas by deploying the All-In-AWS-Infrastructure-Basic example, and by running the integration tests. Here is a list of Node.js Lambdas that I found in this project, and how I tested them:

  • LogExporterFunction
    • Tested using: All-In-AWS-Infrastructure-Basic
    • Not used by default, so I added a logGroupProps to MongoDbInstance and RenderQueue.
    • "Task has completed successfully!" in logs
  • UnhealthyFleetAction
    • Tested using: All-In-AWS-Infrastructure-Basic
    • Created an unhealthy fleet by removing all inbound and output rules in the Worker's security group.
    • "Successfully suspended the fleet ..." in logs
  • AcmImporter / x509-certificate.importCert
    • Tested using: deadline_05_secretsManagement
    • "SUCCESS" in logs
  • mongodb.configureMongo
    • Tested using: deadline_01_repository
    • "SUCCESS" in logs
  • DiskUsage / pad-efs-storage.getDiskUsage
    • Tested using: All-In-AWS-Infrastructure-Basic
    • called in concert with padFilesystem, which completed successfully
  • PadFilesystem / pad-efs-storage.padFilesystem
    • Tested using: All-In-AWS-Infrastructure-Basic
    • "Adding 20GiB of files to the filesystem to grow size. " / "Writing 1024MiB to ..." and no errors in the logs
  • AttachEniToInstance
    • Tested using: deadline_01_repository
    • Confirmed that the StorageStruct3/MongoDB/Server instance had a static ENI attached. Terminated the instance, and confirmed that its replacement had the same static ENI attached.
  • x509-certificate.generate
    • Tested using: deadline_05_secretsManagement
    • "SUCCESS" in logs
  • x509-certificate.convert
    • Tested using: deadline_05_secretsManagement
    • "SUCCESS" in logs
  • Configurator / configure-spot-event-plugin.configureSEP
    • Tested using: deadline_05_secretsManagement
    • "SUCCESS" in logs
  • VersionProviderFunction / ecr-provider.handler
    • Tested using: All-In-AWS-Infrastructure-Basic
    • "SUCCESS" in logs
  • VersionProviderFunction / version-provider.handler
    • Tested using: deadline_05_secretsManagement
    • "SUCCESS" in logs
  • ECSWait / wait-for-stable-service.wait
    • Tested using: deadline_05_secretsManagement
    • "SUCCESS" in logs

I confirmed that all of the Lambdas listed above now use the Node.js 18 runtime.

Tested the lambda-layers by following the steps in the README.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

loachri
loachri previously approved these changes Aug 6, 2024
@rondeau-aws rondeau-aws marked this pull request as ready for review August 7, 2024 23:33
Copy link
Contributor

@marofke marofke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort here Paul! Ship it! 🚢 🐋

Copy link
Contributor

@ddneilson ddneilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing effort sorting through all of those updates. Thank you Paul!

@rondeau-aws rondeau-aws merged commit f1002cb into aws:mainline Aug 8, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants