Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
trace-unhandled
Advanced tools
Node.js warns on unhandled promise rejections. You might have seen:
(node:1234) UnhandledPromiseRejectionWarning
When this happens, it's not always obvious what promise is unhandled. The error displayed in the stack trace is the trace to the error object construction, not the construction of the promise which left it dangling. It might have travelled through various asynchronous chains before it got to an unhandled promise chain.
trace-unhandled
changes this. It keeps track of promises and when an unhandled promise rejection is logged, the location of both the error object and the promise is logged. This makes it a lot easier to find the bug.
This package is not intended to be used in production, only to aid locating bugs
trace-unhandled
exports a program which can run JavaScript files and shebang scripts. Instead of running your program as node index.js
you can do trace-unhandled index.js
as long as trace-unhandled
is globally installed.
You can also use npx
:
npx trace-unhandled index.js
require( 'trace-unhandled/register' ); // As early as possible
or if you want to allow some code to execute before you start tracing:
const { register } = require( 'trace-unhandled' );
// ... whenever you want to start tracing
register( );
To use this package when running jest
, install the package and configure jest with the following setup:
{
setupFiles: [
"trace-unhandled/register"
]
}
The tests will now log much better information about unhandled promise rejections.
FAQs
Much better tracing of unhandled promise rejections in JavaScript
The npm package trace-unhandled receives a total of 49,599 weekly downloads. As such, trace-unhandled popularity was classified as popular.
We found that trace-unhandled demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.