diff --git a/packages/amplify-category-api/src/provider-utils/awscloudformation/base-api-stack.ts b/packages/amplify-category-api/src/provider-utils/awscloudformation/base-api-stack.ts index 6a98f20d59..90a797a225 100644 --- a/packages/amplify-category-api/src/provider-utils/awscloudformation/base-api-stack.ts +++ b/packages/amplify-category-api/src/provider-utils/awscloudformation/base-api-stack.ts @@ -14,6 +14,7 @@ import { Construct } from 'constructs'; import { NETWORK_STACK_LOGICAL_ID } from '../../category-constants'; import Container from './docker-compose/ecs-objects/container'; import { GitHubSourceActionInfo, PipelineWithAwaiter } from './pipeline-with-awaiter'; +import { ResourcesVpcConfig } from 'cloudform-types/types/eks/cluster'; const PIPELINE_AWAITER_ZIP = 'custom-resource-pipeline-awaiter.zip'; @@ -553,6 +554,15 @@ export abstract class ContainersStack extends cdk.Stack { delete cfn.Parameters[k]; } }); + + // Until we update CDK lib to >= 2.87, custom resources use older nodejs version in lambda, + // explicitly overriding the generated resources. + Object.values(cfn.Resources).forEach((resource: any) => { + if (resource.Type === 'AWS::Lambda::Function' && resource.Properties.Runtime && resource.Properties.Runtime !== 'nodejs18.x') { + resource.Properties.Runtime = 'nodejs18.x'; + } + }); + return cfn; } }