Immutable solution version
upstash/redis returns big integers as strings: the 2^53 - 1 JavaScript limit
Complete solution
Integers above 2^53 - 1 come back as strings from @upstash/redis. That is a JavaScript limit, not data corruption.
@upstash/redis returns large numbers as strings
What you see
await redis.set("key", "101600000000150081467"); const res = await redis.get("key"); // res is the string "101600000000150081467", not a number
Why
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.
Fix
- 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.
Verify
Round trip a known big integer and compare as strings. Exact match means everything is working as designed.
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 1 · 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>