aws-cdk: aws-cdk-notices: CDK Notice being parsed incorrectly causing YAMLSemanticError
Describe the bug
When running a CDK Deploy, due to the CDK Notice, it seems to be picked up and parsed by YAML?
This causes a YAMLSemanticError to be produced within one of aws-cdk yaml dependencies.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
2.177.0
Expected Behavior
CDK Deploy should not fail on YAMLSemanticError.
Current Behavior
Error Log Output after CDK Deploy:
/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/resolveSeq-d03cb037.js:1856
doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
^
YAMLSemanticError: Implicit map keys need to be followed by map values
at resolveBlockMapItems (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/resolveSeq-d03cb037.js:1856:33)
at Object.resolveMap [as resolve] (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/resolveSeq-d03cb037.js:1658:79)
at resolveByTagName (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/resolveSeq-d03cb037.js:1430:25)
at resolveTag (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/resolveSeq-d03cb037.js:1460:17)
at resolveNodeValue (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/resolveSeq-d03cb037.js:1581:23)
at Object.resolveNode (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/resolveSeq-d03cb037.js:1629:15)
at parseContents (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/Document-9b4560a1.js:357:30)
at Document.parse (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/Document-9b4560a1.js:615:5)
at parseDocument (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/index.js:44:37)
at Object.parse (/app/node_modules/aws-cdk-lib/node_modules/yaml/dist/index.js:55:15) {
source: PlainValue {
error: null,
range: Range { start: 21443, end: 21531 },
valueRange: Range { start: 21443, end: 21531 },
props: [],
type: 'PLAIN',
value: null,
resolved: Scalar {
value: "\x1B[37mNOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)\x1B[39m",
range: [Array],
type: 'PLAIN'
}
}
}
[06:22:00] failed command: npx ts-node ./src/index.ts
Reproduction Steps
npx aws-cdk deploy
Possible Solution
Stop CDK notices from being picked up by aws-cdk-lib yaml for parsing.
Additional Information/Context
Have tried using environment variable: CDK_NOTICES=false as suggested, but it doesn’t ignore it.
Ref: https://github.com/aws/aws-cdk/wiki/CLI-Notices#what-if-i-dont-want-notices
CDK CLI Version
2.1000.3
Framework Version
No response
Node.js Version
22.14.0
OS
Amazon Linux 2
Language
TypeScript
Language Version
TypeScript (5.3.3)
Other information
Node 22.14.0 / NPM 10.9.2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (13 by maintainers)
Commits related to this issue
- fix(cli): write notices to stderr or don't write them at all On CI systems, the CDK CLI tries to avoid writing to `stderr` because there are a couple of CI systems that are commonly configured to fai... — committed to aws/aws-cdk-cli by rix0rrr 2 years ago
- fix(cli): write notices to stderr or don't write them at all On CI systems, the CDK CLI tries to avoid writing to `stderr` because there are a couple of CI systems that are commonly configured to fai... — committed to aws/aws-cdk-cli by rix0rrr 2 years ago
- fix(cli): write notices to stderr or don't write them at all (#221) (Replaces #188). On CI systems, the CDK CLI tries to avoid writing to `stderr` because there are a couple of CI systems that are c... — committed to aws/aws-cdk-cli by rix0rrr 2 years ago
Hey @mrgrain, thanks for your help—it works perfectly! I just wanted to clarify that the correct flag is
--no-notices. Thanks again! Ref: https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping-env.html#bootstrapping-howto