adrian-goe/nx-aws-cdk-v2

TypeError: process.stdin.end is not a function

Closed this issue · 5 comments

Running a deploy on an AWS CodeBuild image, I received this error:

/codebuild/output/src187330134/src/github.com/xxx/xxxx/node_modules/.pnpm/@ago-dev+nx-aws-cdk-v2@1.2.0_@babel+core@7.20.2/node_modules/@ago-dev/nx-aws-cdk-v2/src/utils/executor.util.js:56
--
165 | process.stdin.end();
166 | ^
167 |  
168 | TypeError: process.stdin.end is not a function
169 | at ChildProcess.<anonymous> (/codebuild/output/src187330134/src/github.com/xxxx/xxxxx/node_modules/.pnpm/@ago-dev+nx-aws-cdk-v2@1.2.0_@babel+core@7.20.2/node_modules/@ago-dev/nx-aws-cdk-v2/src/utils/executor.util.js:56:27)
170 | at ChildProcess.emit (node:events:539:35)
171 | at maybeClose (node:internal/child_process:1092:16)
172 | at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

This is running with NodeJS v16, and I suspect that stdin is not a real stream since that is a headless environment, so it may be lacking the .end() API. A quick fix would be changing line 76 to:

if (process.stdin.end) { process.stdin.end(); }

+1
got the same problem today here 👍

Thanks, I create a beta release in a few minutes, since i have some other changes. Final release would be on the weekend when i finish the other stuff. But should work as before.

After testing with the beta release I found that the problem persisted, so I spent some time investigating... the stdin.end property was defined but was not a function. Changing the check to stdin.isTTY fixed the problem.

I will open another PR with that small change

@rodrigozr thanks for checking and finding a better solution.
I published a new beta version.
https://www.npmjs.com/package/@ago-dev/nx-aws-cdk-v2/v/1.3.0-beta4