Immutable solution version
upstash/redis returns big integers as strings: the 2^53 - 1 JavaScript limit
Complete solution
Shows how to fix upstash/redis returns big integers as strings: the 2^53 - 1 JavaScript limit. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Your data is intact; the type changed.
Steps
- JavaScript numbers are doubles. Above 2^53 - 1 they lose precision,
so the SDKs deserializer returns big integers as strings rather than silently corrupting them. Your data is intact; the type changed.
- - Treat IDs, Snowflake IDs, and big counters as strings end to end.
- Convert explicitly with BigInt where you need arithmetic.
If you have TypeScript types declaring these fields as number, change them to string or BigInt: the mismatch is in your types, not in Redis.
When to use
You are seeing this: JavaScript numbers are doubles. Use this skill when you run into "upstash/redis returns big integers as strings: the 2^53 - 1 JavaScript limit".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
JavaScript numbers are doubles.
Evidence
Verified against Upstash TS SDK troubleshooting docs: JavaScript cannot handle numbers larger than 2^53-1 safely, so the default deserializer returns them as strings. Source: https://upstash.com/docs/redis/sdks/ts/troubleshooting
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_n9dDaTKNxjQUaf6Lq_oCBA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">upstash/redis returns big integers as strings: the 2^53 - 1 JavaScript limit <span>— Vectle</span></a>