amazon-web-servicesaws-cdkaws-cdk-typescript

AWS CDK TS CodeBuild SelfMutate Failing


I'm currently having issues with one of our projects that is using a CodePipeline. Tried to update the packages and also reverted them to their previous versions. It did pass the SynthStep, but I'm not able to deploy the changes as it keeps on failing during the SelfMutate.

Here's the setup we had:

const pipeline = new CodePipeline(this, 'SampleApp', {
    pipelineName: 'SampleApp',
    crossAccountKeys: true,
    synth: new CodeBuildStep('SynthStep', {
            input: source,
            buildEnvironment: {
                buildImage: codebuild.LinuxBuildImage.STANDARD_5_0
            },
            installCommands: [
                'make build_all', // This is for our go-code
                'npm install -g aws-cdk'
            ],
            commands: [
                'npm ci',
                'npm run build',
                'npx cdk synth'
            ],
        }
    )
});

This is the package.json file:

"devDependencies": {
    "@types/jest": "^27.5.2",
    "@types/node": "10.17.27",
    "jest": "^27.5.1",
    "ts-jest": "^27.1.4",
    "aws-cdk": "^2.73.0",
    "ts-node": "^10.9.1",
    "typescript": "^4.8.4"
  },
  "dependencies": {
    "aws-cdk-lib": "2.73.0",
    "constructs": "^10.0.0",
    "source-map-support": "^0.5.21"
}

SelfMutate Log:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'aws-cdk@2.1020.0',
npm WARN EBADENGINE   required: { node: '>= 18.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }

....

Running command cdk -a . deploy SampleAppStack --require-approval=never --verbose
/usr/local/lib/node_modules/aws-cdk/lib/index.js:324667
    var wasmModule = new WebAssembly.Module(bytes);

Is this a common issue with the AWS CDK? Our other projects with the same configuration are working fine.

I'm trying to avoid breaking changes or major environment updates if possible.


UPDATES

Change the build image to Standard 7.0:

buildImage: codebuild.LinuxBuildImage.STANDARD_7_0

As for the package.json:

"devDependencies": {
    ...
    "@types/node": "18.18.14",
    "aws-cdk": "2.178.2",
    ...
  },
  "dependencies": {
    "aws-cdk-lib": "2.178.2",
    ...
}

For the changes to take effect, I had to redeploy the pipeline :) If you're using CodePipeline for CICD, make sure to push your changes and manually deploy the project using cdk deploy.


Solution

  • Support for NodeJS 16 (which has been EOL for almost two years) in AWS CDK was dropped on May 30th.

    Here is the relevant blog post: https://aws.amazon.com/blogs/devops/announcing-the-end-of-support-for-node-js-14-x-and-16-x-in-aws-cdk/

    Here is the PR implementing it: https://github.com/aws/aws-cdk-cli/pull/565