|
4 | 4 |
|
5 | 5 | > **📦 Note for Package Users:** If you install and use these packages via npm, **nothing changed**. This guide is for contributors who develop and maintain these libraries. |
6 | 6 |
|
| 7 | +--- |
| 8 | + |
| 9 | +## 🔴 Node.js 18 Support Dropped |
| 10 | + |
| 11 | +**Effective Date:** October 31, 2025 |
| 12 | + |
| 13 | +### What Changed |
| 14 | + |
| 15 | +Starting with version `2.XX.0` (where XX is the version where this change is released), all Supabase JavaScript libraries require **Node.js 20 or later**. The `@supabase/node-fetch` polyfill has been removed, and native fetch support is now required. |
| 16 | + |
| 17 | +### Why? |
| 18 | + |
| 19 | +Node.js 18 reached end-of-life on April 30, 2025, and no longer receives security updates or critical fixes. Node.js 20+ includes native fetch support, eliminating the need for polyfills and reducing bundle size. |
| 20 | + |
| 21 | +### Affected Libraries |
| 22 | + |
| 23 | +- `@supabase/supabase-js` |
| 24 | +- `@supabase/auth-js` |
| 25 | +- `@supabase/postgrest-js` |
| 26 | +- `@supabase/realtime-js` |
| 27 | +- `@supabase/storage-js` |
| 28 | +- `@supabase/functions-js` |
| 29 | + |
| 30 | +### Migration Guide |
| 31 | + |
| 32 | +**1. Upgrade Node.js** to version 20 or later: |
| 33 | + |
| 34 | +```bash |
| 35 | +# Check your current version |
| 36 | +node --version |
| 37 | + |
| 38 | +# If < 20.0.0, upgrade Node.js |
| 39 | +# Via nvm (recommended): |
| 40 | +nvm install 20 |
| 41 | +nvm use 20 |
| 42 | + |
| 43 | +# Or download from https://nodejs.org/ |
| 44 | +``` |
| 45 | + |
| 46 | +**2. Update your package.json** to use the latest version: |
| 47 | + |
| 48 | +```bash |
| 49 | +npm install @supabase/supabase-js@latest |
| 50 | +# Or for individual packages: |
| 51 | +npm install @supabase/auth-js@latest |
| 52 | +``` |
| 53 | + |
| 54 | +**3. No code changes required** - The APIs remain unchanged. Your existing code will work as-is once you upgrade Node.js. |
| 55 | + |
| 56 | +### Supported Environments |
| 57 | + |
| 58 | +✅ **Node.js 20+** - Native fetch support |
| 59 | +✅ **Modern browsers** - Chrome 42+, Firefox 39+, Safari 10.1+, Edge 14+ |
| 60 | +✅ **Deno 1.0+** - Native fetch built-in |
| 61 | +✅ **Bun 0.1+** - Native fetch built-in |
| 62 | +✅ **React Native** - With fetch polyfill provided by the framework |
| 63 | +✅ **Expo** - With fetch polyfill provided by the framework |
| 64 | + |
| 65 | +### Troubleshooting |
| 66 | + |
| 67 | +**Error: `fetch is not defined`** |
| 68 | + |
| 69 | +This means you're running Node.js < 20. Solutions: |
| 70 | + |
| 71 | +1. Upgrade to Node.js 20+ (recommended) |
| 72 | +2. If you absolutely cannot upgrade, use an older version of the libraries (see below) |
| 73 | + |
| 74 | +**Using Node.js 18 (Not Recommended)** |
| 75 | + |
| 76 | +If you must use Node.js 18, install the last version that supported it: |
| 77 | + |
| 78 | +```bash |
| 79 | +# Find the last version that supported Node.js 18 |
| 80 | +# (This will be version 2.XX.X where XX is one less than the version with this change) |
| 81 | +npm install @supabase/ [email protected] |
| 82 | +``` |
| 83 | + |
| 84 | +⚠️ **Warning:** Using Node.js 18 is not recommended as it no longer receives security updates. |
| 85 | + |
| 86 | +### Discussion |
| 87 | + |
| 88 | +For more details, see the [deprecation announcement](https://github.com/supabase/supabase-js/discussions/37217). |
| 89 | + |
| 90 | +--- |
| 91 | + |
7 | 92 | ## 🎯 Who This Guide Is For |
8 | 93 |
|
9 | 94 | **This guide is for contributors**, including: |
|
0 commit comments