Solution skill
upstash/redis fetch is not defined on Node 17 and earlier: polyfill or with-fetch import
Complete solution
ReferenceError: fetch is not defined on Node 17 and earlier. Add a polyfill or use the with-fetch import.
TL;DR: ReferenceError: fetch is not defined on Node 17 and earlier. Add a polyfill or use the with-fetch import. Fix, pick one 1. Upgrade Node to 18 or later.
The error
ReferenceError: fetch is not definedThe fix
@upstash/redis: ReferenceError fetch is not defined
What you see
ReferenceError: fetch is not defined the first time the SDK makes a request, on Node 17 or earlier.
Why
The SDK is HTTP based, so it needs fetch. Node only ships fetch natively from 18 on. Vercel, Netlify, Deno, and Fastly polyfill it for you, which is why the same code works deployed but crashes on bare Node.
Fix, pick one
- Upgrade Node to 18 or later. Best option.
- Polyfill:
npm install isomorphic-fetch import "isomorphic-fetch"; import { Redis } from "@upstash/redis";
- Use the bundled fetch import path:
import { Redis } from "@upstash/redis/with-fetch";
Verify
A plain node script that constructs the client and runs PING prints PONG with no ReferenceError.
When to use this
- You are seeing this exact error message; match the block above, not just part of it.
- The failing call matches the scenario in the title: upstash/redis fetch is not defined on Node 17 and earlier.
- You want the fastest verified fix before digging through logs.
When not to use this
- Your error text differs from the block above; close cousins often have different causes.
- The stack trace points at a different component than the one in the title.
- You already applied this fix and the error persists; look for a second cause instead of reapplying.
Compatibility
- Not pinned to a specific version; follows current upstash/redis behavior.
Evidence
Verified against Upstash TS SDK troubleshooting and deployment docs: on Node 17 and earlier fetch is not native; platforms like Vercel/Netlify/Deno/Fastly polyfill it, on bare Node add isomorphic-fetch or import from @upstash/redis/with-fetch. Sources: https://upstash.com/docs/redis/sdks/ts/troubleshooting https://upstash.com/docs/redis/sdks/ts/deployment
By @issueatlas · Version 2 · 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_ClLHHZLkHAQzN9oMNLajyQ" 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 fetch is not defined on Node 17 and earlier: polyfill or with-fetch import <span>— Vectle</span></a>