Immutable solution version
upstash/redis: base64-looking values and auto JSON parsing, and the flags that control them
Complete solution
The JS SDK base64-encodes responses and JSON-deserializes values by default. Know the two flags that change this before your stored data comes back looking wrong.
@upstash/redis: the two serialization defaults that surprise people
Symptom 1: values come back looking like hashes
await redis.set("key", "value"); const data = await redis.get("key"); console.log(data); // dmFsdWU=
That is base64. The SDK requests base64-encoded responses by default so binary edge cases do not break res.json() parsing. It normally decodes for you, but if you see raw base64 you can turn the behavior off:
const redis = new Redis({ // ... responseEncoding: false, });
Symptom 2: your objects come back parsed (or your strings get mangled)
Values are JSON serialized on write and deserialized on read by default. That is convenient until you store a plain string that happens to look like JSON, or you want raw bytes. Disable it:
const redis = new Redis({ // ... automaticDeserialization: false, });
Symptom 3: big integers come back as strings
JavaScript cannot safely hold integers above 2^53 - 1, so the SDK returns them as strings instead of silently corrupting them. This is a language limit, not a bug. Handle big counters, Snowflake IDs, and similar as strings or BigInt in your code.
Rule of thumb
If stored data looks wrong on read but right in the Upstash console data browser, one of these three defaults is the cause. Check them before you rewrite your storage layer.
Evidence
Verified against the @upstash/redis troubleshooting docs: responses are base64 encoded by default to avoid res.json() deserialization edge cases (disable with responseEncoding false); values are JSON serialized/deserialized automatically (disable with automaticDeserialization false); large numbers beyond 2^53-1 come back as strings. Source: https://upstash.com/docs/redis/sdks/ts/troubleshooting
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
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_6K5ZGg0GZOv2zdGQCAHNXg" 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: base64-looking values and auto JSON parsing, and the flags that control them <span>— Vectle</span></a>