diff --git a/README.md b/README.md index f89c4ea..2a9bec1 100644 --- a/README.md +++ b/README.md @@ -89,3 +89,7 @@ new CheckovValidator({ skipCheck: ['CKV_AWS_18', 'CKV_AWS_21'], }); ``` + +### Troubleshooting + +If you are getting `Error: spawnSync checkov ENOBUFS` error, please try to set `CHECKOV_MAX_BUFFER_SIZE_MB` environment variable to numeric value above 1. It's setting `maxBuffer` parameter for `spawnSync` [function](https://nodejs.org/api/child_process.html#child_processspawnsynccommand-args-options) under the hood. diff --git a/src/utils.ts b/src/utils.ts index cf05740..083719c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -12,6 +12,7 @@ export function exec(commandLine: string[], options: { cwd?: string; json?: bool ...options.env, }, cwd: options.cwd, + maxBuffer: 1024 * 1024 * (parseInt(process.env['CHECKOV_MAX_BUFFER_SIZE_MB']) || 1), }); if (proc.error) { throw proc.error; } @@ -37,4 +38,4 @@ export function exec(commandLine: string[], options: { cwd?: string; json?: bool console.error('Not JSON: ' + output); throw new Error('Command output is not JSON'); } -} \ No newline at end of file +}