Skip to main content

ReferenceError: fetch is not defined#

Problem#

If you are running on nodejs v17 and earlier, fetch will not be natively supported. Platforms like Vercel, Netlify, Deno, Fastly etc. provide a polyfill for you. But if you are running on bare node, you need to add a polyfill.

Solution#

Hashed Response#

The response from a server is not what you expect but looks like a hash?

Problem#

Versions of @upstash/redis before 1.40.0 request base64 encoded responses from the server by default. If a response reaches your code without being decoded, you see the base64 encoded value.

Solution#

Upgrade to @upstash/redis 1.40.0 or later, which requests plain responses by default, or set responseEncoding to false in the options.

Large numbers are returned as string#

You are trying to load a large number and it is returned as a string instead.

Problem#

Javascript can not handle numbers larger than 2^53 -1 safely and would return wrong results when trying to deserialize them. In these cases the default deserializer will return them as string instead. This might cause a mismatch with your custom types.

Solution#

Please be aware that this is a limitation of javascript and take special care when handling large numbers.