Your sort does nothing in Node and works in Bun
A comparator that returns true or false never returns a negative number, so V8 leaves the array exactly as it was. The same line sorts correctly in Bun, which is why it survives code review and ships.
26 posts
A comparator that returns true or false never returns a negative number, so V8 leaves the array exactly as it was. The same line sorts correctly in Bun, which is why it survives code review and ships.
toLocaleString groups French numbers with a narrow no-break space, not a normal one. The two strings print the same, fail ===, and the obvious fix turns 1234.5 into 1 without throwing.
JavaScript sorts number-like keys to the front of every object, so an ID-keyed list loses the order your API sent. UUID fixtures hide it. Here is the fix.
A logger that reports where each log came from kept naming one identical line for the app. Its stack-frame filter never skipped itself. Bug, repro, fix.
URLSearchParams sends missing filters as the literal word 'undefined'. The truthy filter that seems to fix it then quietly drops page=0.
I assumed my Next.js logger was stuffed with React. One grep said 3 files out of 36. A second grep found two more that import nothing at all.
Two reconnect attempts overlap, the slow one finishes last, and your client now trusts a socket that is already gone. ioredis stops this with a single counter. Here is the race, in 30 lines you can run.
jose 5 shipped two complete crypto implementations, one for Node and one for browsers. jose 6 ships one. I counted the files and ran the code in both.
Web Crypto signs a JWT with a 512-bit RSA key and calls it valid. RFC 7518 wants 2048 bits. Where that check lives, and how to test your own keys.
Reaching for .buffer to turn a Node Buffer into an ArrayBuffer hands you the whole 8KB allocation pool, not your 15 bytes. Here is the HMAC it silently breaks, the password it leaks, and why it works fine on a big payload and fails on a small one.
Standard Schema grew from one spec into three, and all three use the same ~standard key. So 'does it have ~standard' no longer tells you what the schema can actually do. Here is a crash you can reproduce with Zod and Valibot, and the two-line check that fixes it.
I tested every way to copy an object with a __proto__ key. Spread is safe, Object.assign is not, and only one of them reaches Object.prototype.
A loop of awaited fetch() calls to one host keeps exactly two sockets open. I measured why, and the one-line change that drops it to one.
A delay over 24.9 days overflows a 32-bit int, so setTimeout runs at once. What I measured in Node and Chrome, plus a long-timer fix.
I built a fake Postgres server to watch postgres.js on the wire. Ten queries left in one packet — but the first run of each one always waits alone.
My logger read the active OpenTelemetry span off globalThis. It returned null every single time, and the unit test still passed. Here is the real fix, tested.
My logger claimed it blocked newline injection. It only stripped carriage returns. Here is the real log injection bug and the fix I tested.
A request hook that merges headers with the spread operator keeps the token it just added and silently deletes every header the caller sent. Here is the test that proves it, in Node and in Chrome.
INCR then PEXPIRE is the standard Redis rate limit. I tested what happens when the second one fails, and found a key that never expires.
I tested pino's sonic-boom write stream: it does not buffer log lines by default, and a full buffer drops lines while write() still returns true.
new URL(path, baseURL) is not string joining. A leading slash wipes your base path, a missing trailing slash eats a segment, and the wrong path can send your auth token to someone else's server.
I hand-rolled an OTLP log exporter and tested it. Bare int64 numbers, ms times 1e6 timestamps, wrong severity and base64 trace IDs all still return 200.
One BigInt makes JSON.stringify throw, so your logger drops every other field too. What I measured, and a safe() helper that keeps Dates and Errors intact.
AbortSignal.timeout() starts counting when you create it, not when fetch runs. In a queue or retry loop it quietly kills requests still waiting their turn.
Everyone says console.time() breaks under concurrency because the second call overwrites the first. I tested it in Node, Bun and Deno, and that is not what happens. The second timer is thrown away, the fast request reports the slow request's duration, and the slow request reports nothing at all.
AsyncLocalStorage lets you stamp a request ID onto every log line without passing it through every function. But it can fail without throwing a single error — so your logs just quietly lose the ID. Here are the three cases I reproduced, and the two-minute check that catches them.