cdk-validator-cfnguard
cdk-validator-cfnguard copied to clipboard
Error: Error: spawnSync /Users/ahammond/Documents/ClickUp/infratest-service-cdk/node_modules/@cdklabs/cdk-validator-cfnguard/bin/macos/cfn-guard ENOBUFS
I tried
const app = new App({ policyValidationBeta1: [new CfnGuardValidator()] });
after adding the lib and got
❯ npx cdk list
Performing Policy Validations
Validation Report
-----------------
╔════════════════════════════════════╗
║ Plugin Report ║
║ Plugin: cdk-validator-cfnguard ║
║ Version: 0.0.58 ║
║ Status: failure ║
╚════════════════════════════════════╝
Metadata:
error: Validation plugin 'cdk-validator-cfnguard' failed:
CfnGuardValidator plugin failed processing cfn-guard results.
Please create an issue https://github.com/cdklabs/cdk-validator-cfnguard/issues/new
Error: Error: spawnSync /Users/ahammond/Documents/ClickUp/infratest-service-cdk/node_modules/@cdklabs/cdk-validator-cfnguard/bin/macos/cfn-guard ENOBUFS
Policy Validation Report Summary
╔════════════════════════╤═════════╗
║ Plugin │ Status ║
╟────────────────────────┼─────────╢
║ cdk-validator-cfnguard │ failure ║
╚════════════════════════╧═════════╝
Validation failed. See the validation report above for details
Subprocess exited with error 1
This is with
node v20.5.1
"@cdklabs/cdk-validator-cfnguard": "^0.0.58",
"aws-cdk-lib": "^2.130.0",
Hi, @ahammond. I can't reproduce this. Is there a minimal example you can share?
I'll build one. Thank you for looking!
Hello,
I have a similar issue here: Metadata: error: Validation plugin 'cdk-validator-cfnguard' failed: CfnGuardValidator plugin failed processing cfn-guard results. Please create an issue https://github.com/cdklabs/cdk-validator-cfnguard/issues/new Error: Error: spawnSync /tmp/jsii-kernel-XXRYsE/node_modules/@cdklabs/cdk-validator-cfnguard/bin/ubuntu/cfn-guard ENOBUFS
I'm seeing this where the execution is exceeding maxBuffer.
The default value is 1MB, see https://nodejs.org/api/child_process.html#child_processspawnsynccommand-args-options and https://github.com/nodejs/node/issues/9829
Overriding to a sufficiently large value, and possibly making it configurable as well, might be a solution?
In the meantime, I'm working through the violations by simply overriding this locally
e.g. in node_modules/@cdklabs/cdk-validator-cfnguard/lib/utils.js
[..]
function exec(commandLine, options = {}) {
const proc = (0, child_process_1.spawnSync)(commandLine[0], commandLine.slice(1), {
stdio: ['ignore', 'pipe', options.verbose ? 'inherit' : 'pipe'],
env: {
...process.env,
...options.env,
},
cwd: options.cwd,
maxBuffer: 1024 * 1024 * 10, <-- 10MB override
});
[..]
I am having this issue as well.