uploader: codecov exits with status code 4 if NODE_OPTIONS is set

Describe the bug

The pkg node module has an issue where if NODE_OPTIONS is set to --max-old-space-size=8192 (it doesn’t need to be 8192, the issues mentioned below use 4096) the application will exit with status 4. It’s literally this line in the pkg code:

https://github.com/vercel/pkg/blob/5.3.3/prelude/bootstrap.js#L1789

No error messages are printed. The app built with pkg just exits. This issue: https://github.com/vercel/pkg/issues/1194 and this one: https://github.com/vercel/pkg/issues/1217 mention the problem with no resolution.

To Reproduce In a shell:

export NODE_OPTIONS=--max-old-space-size=8192
./codecov
echo $?

The output from the echo will be 4.

Expected behavior

Program just runs

Screenshots

N/A

Additional context

The circleci orb should unset NODE_OPTIONS before invoking codecov

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Oh, we set it. 😄

We set NODE_OPTIONS=–max-old-space-size=8192 as part of our build to give webpack more RAM than the default of 4GB for a node application IIRC. Makes builds a bit faster than glacial, and webpack is less likely to fall over because it ran out of RAM.

@drazisil-codecov Yes, 100% an issue with NODE_OPTIONS set, 100% success after calling unset NODE_OPTIONS before invoking ./codecov.

We are running a large machine on circleci.

The fix may be to file a bug report with the pkg team to call delete process.env.NODE_OPTIONS; here: https://github.com/vercel/pkg/blob/main/prelude/bootstrap.js#L1787 before building and running the Script. But I am not familiar with how Script.runInThisContext works internally so it may or may not work.

I mostly filed this bug report so you could add a note to the README about clearing NODE_OPTIONS before invoking codecov and update the orb to clear NODE_OPTIONS too. 😄