finds.dev← search

// the find

mcollina/make-promises-safe

★ 667 · JavaScript · MIT · updated Dec 2024

A node.js module to make the use of promises safe

A one-file shim that installs an `unhandledRejection` handler so Node.js exits on unhandled promise rejections instead of silently leaking memory and file descriptors. Historically useful for Node 6–14; Node 15+ already does this by default. At this point it's mainly a compatibility layer for projects that still target older runtimes.

Solves a real and non-obvious footgun — the asymmetry between uncaught exceptions (crash) and unhandled rejections (silence) burned a lot of people. The preloader mode (`node -r make-promises-safe`) is clean, zero code change required. TypeScript definitions included. Core dump support via `.abort = true` is genuinely useful for postmortem debugging in production.

Essentially obsolete for anyone on Node 15+, which is almost everyone in 2025. The README says so clearly, but the package still gets pulled in by older project templates and lock files where nobody noticed. No mechanism to distinguish 'this rejection will be handled later in the microtask queue' from a genuine unhandled one, so it can produce false-positive exits in some async patterns. 667 stars for what is now a two-line polyfill — the star count is a historical artifact, not a quality signal.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →