Skip to content

Conversation

@gleb-centrica
Copy link

Summary


Updates the default runtime version to nodejs22.x for custom resource backing lambda functions in case provider runtime is NOT nodejs

It addresses the issue that was brought up here #57 (comment)

Impact


  • ✅ Fixes version nodejs 18 that is approaching deprecation for custom resource lambdas

Verification


  • ✅ Unit tests for regression
  • ✅ added new unit tests
  • ✅ Small demo project with python runtime set up and deployed with all 4 custom resource and their backing lambda functions, All lambdas get default nodejs22 runtime
image

Every lambda function successfully executed during the deployment process
image

and CF stack got deployed successfully.

  • ✅ integration tests for regression

There is one caveat to the above ITs. It looks like some ITs are flaky because of potential bugs in the code(?)
They are not affected by the change above they are failing for a different reason as they do not fallback to default nodejs version.
e.g api-gateway.test.js

Error:\nCREATE_FAILED: CustomApiGatewayAccountCloudWatchRole (Custom::ApiGatewayAccountRole)\nReceived response status [FAILED] from custom resource. Message returned: The role with name serverlessApiGatewayCloudWatchRole cannot be found

CW role custom resource handler tries to attach policies iam.send(new ListAttachedRolePoliciesCommand({ RoleName: roleName }))).AttachedPolicies and if the role doesn't exist (it wasn't supplied to the provider as roleArn) error happens and it tries to fallback to creating a role but it looks like the condition is wrong if (error.code === 'NoSuchEntity') according to the docs https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-iam/Class/NoSuchEntityException/ there is no such field available as code. And the handler just throws an error and the test fails.
If condition is adjusted then test successfully passes.

@gleb-centrica gleb-centrica marked this pull request as draft October 24, 2025 10:33
@gleb-centrica gleb-centrica marked this pull request as ready for review October 27, 2025 08:40
@mnapoli
Copy link
Contributor

mnapoli commented Oct 28, 2025

Thanks!

@mnapoli mnapoli merged commit 7a1808a into oss-serverless:main Oct 28, 2025
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.

2 participants