#javascriptbackend — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #javascriptbackend, aggregated by home.social.
-
What's wrong with this JavaScript AbortController not aborting?
What's wrong with this JavaScript AbortController not aborting fetch. The JavaScript code creates AbortController but never calls abort. In JavaScript cleanup never runs and requests pile up.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreli...
-
Why does this JavaScript sort put 10 before 2?
Why does this JavaScript sort put 10 before 2 in a leaderboard. The JavaScript code uses sort without a comparator, so numbers are sorted as strings. In JavaScript apps this breaks every numeric ranking.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliabili...
-
What's wrong with this JavaScript parseInt losing digits?
What's wrong with this JavaScript parseInt losing digits on user input. The JavaScript code parses a string without radix, so leading zeros trigger octal in older engines. In JavaScript APIs this corrupts IDs.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #ja...
-
What's wrong with this JavaScript unhandled rejection?
What's wrong with this JavaScript unhandled rejection crashing Node. The JavaScript code returns a promise without catch. In JavaScript unhandled rejections can terminate the process.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascri...
-
What's wrong with this JavaScript this in callback?
What's wrong with this JavaScript this in a callback losing context. The JavaScript code passes a method as callback and this becomes undefined. In JavaScript event handlers the method loses its instance.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptrel...
-
What's wrong with this JavaScript async loop?
What's wrong with this JavaScript async loop in a task runner. The JavaScript code uses forEach with async callbacks, so errors and awaits are ignored. In JavaScript services this drops failures and hides retries.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascript...
-
Why does this JavaScript optional chaining hide the bug?
Why does this JavaScript optional chaining hide the bug in a form. The JavaScript code uses optional chaining when the value could be zero. In JavaScript 0 is valid but optional chaining skips it.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliab...
-
Why does this JavaScript negative zero exist?
Why does this JavaScript negative zero exist and break sign check. The JavaScript code checks if a value is negative with less than zero. In JavaScript -0 fails the check and passes as positive.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javasc...
-
What's wrong with this JavaScript typeof null?
What's wrong with this JavaScript typeof null returning object. The JavaScript code checks typeof before accessing properties. In JavaScript validation this lets null through and crashes on property access.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliab...
-
Why does this JavaScript map drop entries?
Why does this JavaScript map drop entries in production. The JavaScript code uses JSON stringify as a map key, so object key ordering changes and collisions overwrite data. In JavaScript services this corrupts caches.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascrip...
-
What's wrong with this JavaScript JSON parse of numbers?
What's wrong with this JavaScript JSON parse of numbers losing precision. The JavaScript code parses JSON with large integers. In JavaScript numbers over 2^53 lose precision.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascriptapi #...
-
What's wrong with this JavaScript prototype pollution?
What's wrong with this JavaScript prototype pollution from user merge. The JavaScript code merges user input into an object. In JavaScript __proto__ or constructor can pollute all objects.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #jav...
-
What's wrong with this JavaScript RegExp stateful?
What's wrong with this JavaScript RegExp stateful with global flag. The JavaScript code reuses a regex with g flag. In JavaScript lastIndex persists and the next match starts from wrong position.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #...
-
What's wrong with this JavaScript temp file?
What's wrong with this JavaScript temp file creation in a report worker. The JavaScript code writes to a predictable path in /tmp, which can be hijacked with symlinks. In JavaScript servers this can overwrite sensitive files.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance ...
-
Why does this JavaScript trim not removing all whitespace?
Why does this JavaScript trim not removing all whitespace. The JavaScript code uses trim on user input. In JavaScript trim only handles space tab newline not unicode spaces.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascriptapi ...
-
What's wrong with this JavaScript BigInt mixing with Number?
What's wrong with this JavaScript BigInt mixing with Number in a calculator. The JavaScript code adds BigInt and Number. In JavaScript this throws and crashes the app.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascriptapi #jav...
-
What's wrong with this JavaScript Object.assign overwriting?
What's wrong with this JavaScript Object.assign overwriting nested objects. The JavaScript code uses Object.assign for config merge. In JavaScript nested objects are copied by reference and get overwritten.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #ja...
-
Why does this JavaScript NaN break every comparison?
Why does this JavaScript NaN break every comparison in a validator. The JavaScript code uses === to check for NaN but NaN is not equal to itself. In JavaScript forms invalid numbers pass silently.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliabilit...
-
Why does this JavaScript toFixed return string?
Why does this JavaScript toFixed return string in a sum. The JavaScript code uses toFixed for display and then adds the result. In JavaScript toFixed returns a string so addition concatenates.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javasc...
-
Why does this JavaScript Object is vs === for NaN?
Why does this JavaScript Object is vs === for NaN check. The JavaScript code uses === to detect NaN. In JavaScript Object.is is needed for NaN and negative zero.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascriptapi #javascriptengineeri...
-
Why does this JavaScript WeakMap key garbage collected?
Why does this JavaScript WeakMap key garbage collected too early. The JavaScript code stores data in WeakMap keyed by object. In JavaScript without a strong reference the entry disappears.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #ja...
-
Why does this JavaScript retry charge customers twice?
Why does this JavaScript retry logic charge customers twice in production. The JavaScript code retries a payment call after a timeout without an idempotency key, so the gateway processes duplicates. In JavaScript billing services this creates double charges and refunds.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascrip...
-
Why does this JavaScript Object keys on array?
Why does this JavaScript Object keys on array returning string indices. The JavaScript code uses Object.keys on an array. In JavaScript keys are string numbers and holes are skipped.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascriptapi #ja...
-
Why does this JavaScript substring vs substr deprecated?
Why does this JavaScript substring vs substr giving different results. The JavaScript code uses substr which is deprecated and has different semantics. In JavaScript substr start and length vs substring start and end.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperforma...
-
Why does this JavaScript Array from object returning wrong?
Why does this JavaScript Array from object returning wrong length. The JavaScript code creates array from array-like using length. In JavaScript a malicious length can allocate huge or wrong size.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptrel...
-
What's wrong with this JavaScript Array push return?
What's wrong with this JavaScript Array push return in a chain. The JavaScript code chains after push assuming it returns the array. In JavaScript push returns the new length not the array.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #java...
-
What's wrong with this JavaScript setTimeout closure?
What's wrong with this JavaScript setTimeout closure in a loop. The JavaScript code creates timeouts in a loop with var. In JavaScript all callbacks see the final value.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascriptapi #javascri...
-
What's wrong with this JavaScript default parameter evaluation?
What's wrong with this JavaScript default parameter evaluation timing. The JavaScript code uses an expression as default. In JavaScript defaults are evaluated at call time and can have side effects.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascr...
-
What's wrong with this JavaScript cache data?
What's wrong with this JavaScript cache data in a response handler. The JavaScript code caches a mutable array and returns it directly, so callers mutate shared state. In JavaScript services this causes ghost data.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascrip...
-
What's wrong with this JavaScript Map for object keys?
What's wrong with this JavaScript Map for object keys with reference equality. The JavaScript code uses objects as Map keys. In JavaScript key lookup uses reference so same-shaped objects do not match.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptrel...
-
Why does this JavaScript scheduler drift?
Why does this JavaScript scheduler drift in reporting. The JavaScript code mutates a Date object and reuses it, so every window shifts forward. In JavaScript jobs this breaks hourly aggregation.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascript...
-
Why does this JavaScript scheduler drift?
Why does this JavaScript scheduler drift in reporting. The JavaScript code mutates a Date object and reuses it, so every window shifts forward. In JavaScript jobs this breaks hourly aggregation.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascript...
-
Why does this JavaScript scheduler drift?
Why does this JavaScript scheduler drift in reporting. The JavaScript code mutates a Date object and reuses it, so every window shifts forward. In JavaScript jobs this breaks hourly aggregation.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascript...
-
Why does this JavaScript scheduler drift?
Why does this JavaScript scheduler drift in reporting. The JavaScript code mutates a Date object and reuses it, so every window shifts forward. In JavaScript jobs this breaks hourly aggregation.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascript...
-
Why does this JavaScript lock file race?
Why does this JavaScript lock file race under concurrency. The JavaScript code checks for a lock file and then creates it, which is a classic TOCTOU race. In JavaScript workers this lets two processes run the same job.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascript...
-
Why does this JavaScript lock file race?
Why does this JavaScript lock file race under concurrency. The JavaScript code checks for a lock file and then creates it, which is a classic TOCTOU race. In JavaScript workers this lets two processes run the same job.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascript...
-
Why does this JavaScript lock file race?
Why does this JavaScript lock file race under concurrency. The JavaScript code checks for a lock file and then creates it, which is a classic TOCTOU race. In JavaScript workers this lets two processes run the same job.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascript...
-
Why does this JavaScript lock file race?
Why does this JavaScript lock file race under concurrency. The JavaScript code checks for a lock file and then creates it, which is a classic TOCTOU race. In JavaScript workers this lets two processes run the same job.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascript...