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

Error: Error: spawnSync /Users/ahammond/Documents/ClickUp/infratest-service-cdk/node_modules/@cdklabs/cdk-validator-cfnguard/bin/macos/cfn-guard ENOBUFS #313

Open
ahammond opened this issue Feb 29, 2024 · 5 comments
Assignees

Comments

@ahammond
Copy link

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",
@otaviomacedo
Copy link
Contributor

Hi, @ahammond. I can't reproduce this. Is there a minimal example you can share?

@ahammond
Copy link
Author

ahammond commented Mar 6, 2024

I'll build one. Thank you for looking!

@Kusus886
Copy link

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

@roblambell
Copy link

roblambell commented Sep 3, 2024

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 nodejs/node#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
    });
[..]

@justin-masse
Copy link

I am having this issue as well.

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

5 participants