TypeError on Object.entries for audit advisories
Closed this issue ยท 3 comments
Hi there. Trying to run this in one of our repositories and it fails with this error:
npx: installed 1 in 0.821s
(node:102) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at pushAllReports (/root/.npm/_npx/102/lib/node_modules/bpr-npm-audit/index.js:139:40)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:102) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:102) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This is the line it's pointing to:
for (const [ id, advisory ] of Object.entries(audit.advisories))
Not sure how audit or advisories could be undefined or null. The repo setup is a little non-standard as the npm package is one folder down from the repository root, but I wouldn't think that it would affect this in this way.
We do have this set up in a separate repository and it is making it past this.
Have you seen this error before? Any ideas on what could be going wrong here? Anything else I can provide that might help?
Looks like the output of npm audit
changed: https://github.com/npm/cli/blob/latest/changelogs/CHANGELOG-7.md#npm-audit
I actually have a little free time today, so I'll see if I can figure it out.
Alright, took a couple iterations, but I got it working again.
Backwards compatible, so not a breaking change ๐ live on npm now as 1.4.1 (see release notes)
Thanks for the quick action! ๐