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

CDK Synth pipeline step fails because of old version of Node used in the build image #26

Open
josebagar opened this issue Nov 8, 2022 · 1 comment

Comments

@josebagar
Copy link
Contributor

LinuxBuildImage.AMAZON_LINUX_2_ARM_2 is the build image used for the CodePipeline pipelines CDK_Synth & Application_Build. This image includes Node 10.24.1 & Node 12.22.2 (please see the Dockerfile) but not Node 14, as is required in the README and the pipeline build fails.

This causes the CDK Synth step to fail because of an unsupported language feature (the ?? operator) being used in the code. The code should probably use another image which provides the required Node version.

@josebagar
Copy link
Contributor Author

josebagar commented Nov 16, 2022

I have manually built the AL2 image from commit 206fa376d3cd3420b28c52c0517d1da0e895e01f of the Dockerfile following the instructions outlined in its README and have been able to replicate the problem. Here's the output of the npm run cdk synth command:

bash-4.2# npm run cdk synth

> [email protected] cdk /root/aws-cross-account-cicd-pipeline
> cdk "synth"

/root/aws-cross-account-cicd-pipeline/node_modules/aws-cdk/lib/index.js:12413
    home = path.join((os.userInfo().homedir ?? os.homedir()).trim(), ".cdk");
                                             ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/root/aws-cross-account-cicd-pipeline/node_modules/aws-cdk/bin/cdk.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cdk: `cdk "synth"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] cdk script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-11-16T10_56_53_808Z-debug.log

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

No branches or pull requests

1 participant