Skip to main content
supabase-upgrade-migration Upgrade Supabase SDK and CLI versions with breaking-change detection and automated code migration.
Use when upgrading @supabase/supabase-js (v1→v2 or minor bumps), migrating auth/realtime/storage
APIs, or updating the Supabase CLI. Trigger with phrases like "upgrade supabase",
"supabase breaking changes", "migrate supabase v2", "update supabase SDK".
설치로 이동 Skills Marketplace 커뮤니티가 만든 AI 스킬을 발견하고 탐색하세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill supabase-upgrade-migration명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Zip 다운로드 다운로드 중... 이 저장소의 다른 Skills Implement user sign-up and sign-in flows with Clerk.
Use when building authentication UI, customizing sign-in experience,
or implementing OAuth social login.
Trigger with phrases like "clerk sign-in", "clerk sign-up",
"clerk login flow", "clerk OAuth", "clerk social login".
Implement session management and middleware with Clerk.
Use when managing user sessions, configuring route protection,
or implementing token refresh and custom JWT templates.
Trigger with phrases like "clerk session", "clerk middleware",
"clerk route protection", "clerk token", "clerk JWT".
Configure enterprise SSO, role-based access control, and organization management.
Use when implementing SSO integration, configuring role-based permissions,
or setting up organization-level controls.
Trigger with phrases like "clerk SSO", "clerk RBAC",
"clerk enterprise", "clerk roles", "clerk permissions", "clerk organizations".
jeremylongshore
jeremylongshore/claude-code-plugins-plus-skills
GitHub 저장소 열기 name supabase-upgrade-migration description Upgrade Supabase SDK and CLI versions with breaking-change detection and automated code migration.
Use when upgrading @supabase/supabase-js (v1→v2 or minor bumps), migrating auth/realtime/storage
APIs, or updating the Supabase CLI. Trigger with phrases like "upgrade supabase",
"supabase breaking changes", "migrate supabase v2", "update supabase SDK".
allowed-tools Read, Write, Edit, Bash(npm:*), Bash(npx:*), Bash(pip:*), Bash(supabase:*), Bash(git:*), Grep, Glob version 1.53.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","supabase","migration","upgrade","sdk"] compatibility Designed for Claude Code, also compatible with Codex and OpenClaw
Supabase Upgrade Migration
Overview
Upgrade @supabase/supabase-js and the Supabase CLI with breaking-change detection, automated code migration, and rollback planning. Covers the v1-to-v2 migration path (auth method renames, data/error destructuring, realtime API overhaul), minor version bumps, @supabase/ssr adoption, and Python SDK upgrades via pip install --upgrade supabase.
Current State
!npm list @supabase/supabase-js 2>/dev/null | grep supabase || echo 'supabase-js not installed'
!supabase --version 2>/dev/null || echo 'CLI not installed'
!pip show supabase 2>/dev/null | grep Version || echo 'Python SDK not installed'
Prerequisites
@supabase/supabase-js or the Python supabase package installed in the project
Git with a clean working tree (no uncommitted changes)
Test suite available for post-upgrade verification
Node.js >= 18 (for supabase-js v2) or Python >= 3.8 (for Python SDK)
Instructions
Step 1: Audit Versions, Scan Usage, and Review Breaking Changes
Check every installed Supabase package and find all import sites in the codebase.
npm list @supabase/supabase-js
supabase --version
pip show supabase | grep Version
grep -rn "from '@supabase/supabase-js'" --include="*.ts" --include="*.tsx" --include="*.js" src/ lib/ app/ 2>/dev/null
grep -rn "createClient" --include="*.ts" --include="*.tsx" --include="*.js" src/ lib/ app/ 2>/dev/null
grep -rn "from supabase" --include="*.py" src/ app/ 2>/dev/null
supabase-js v1 → v2 breaking changes:
createClient(url, key)createClient(url, key)Signature unchanged, but return type differs supabase.auth.session()supabase.auth.getSession()Sync → async, returns { data: { session } } supabase.auth.user()supabase.auth.getUser()Sync → async, returns { data: { user } } supabase.auth.signIn({ email, password })supabase.auth.signInWithPassword({ email, password })Method split by auth type supabase.auth.signIn({ provider: 'google' })supabase.auth.signInWithOAuth({ provider: 'google' })OAuth separated supabase.auth.signIn({ email })supabase.auth.signInWithOtp({ email })Magic link separated supabase.auth.api.resetPasswordForEmail(e)supabase.auth.resetPasswordForEmail(e).api namespace removed{ data: subscription } from onAuthStateChange{ data: { subscription } }Extra destructuring level error.message string parsingerror.code enum (PGRST116, etc.)Reliable error matching .single() returns error on 0 rows.maybeSingle() for optional rowsNew method for nullable results supabase.from('t').on('INSERT', cb).subscribe()supabase.channel('c').on('postgres_changes', ...).subscribe()Realtime v2 channel API supabase.storage.from('b').download('path')Same, but returns { data: Blob, error } Consistent error/data tuple
Realtime v2 migration detail:
supabase
.from ('messages' )
.on ('INSERT' , (payload ) => console .log (payload.new ))
.subscribe ()
supabase
.channel ('messages-insert' )
.on ('postgres_changes' , { event : 'INSERT' , schema : 'public' , table : 'messages' },
(payload ) => console .log (payload.new ))
.subscribe ()
Step 2: Run the Upgrade and Apply Code Migrations Create a branch, install new packages, and transform code to match v2 APIs.
git checkout -b upgrade-supabase-sdk
npm install @supabase/supabase-js@latest
npm install @supabase/ssr@latest
npm install -g supabase@latest
pip install --upgrade supabase
npx supabase gen types typescript --linked > lib/database.types.ts
npx supabase db diff --use-migra -f upgrade_check
Apply auth code migrations:
const session = supabase.auth .session ()
const user = supabase.auth .user ()
const { error } = await supabase.auth .signIn ({ email, password })
const { data : subscription } = supabase.auth .onAuthStateChange (callback)
const { data : { session } } = await supabase.auth .getSession ()
const { data : { user } } = await supabase.auth .getUser ()
const { error } = await supabase.auth .signInWithPassword ({ email, password })
const { data : { subscription } } = supabase.auth .onAuthStateChange (callback)
Apply error handling migration:
if (error.message .includes ('not found' )) { ... }
if (error.code === 'PGRST116' ) { ... }
Step 3: Verify, Test, and Prepare Rollback
npx tsc --noEmit
npm test
python -m pytest tests/ -v
Rollback procedure (if upgrade causes issues):
# Option A: Pin to previous version
npm install @supabase/supabase-js@<previous-version>
pip install supabase==<previous-version>
# Option B: Revert the branch
git stash && git checkout main
Output
@supabase/supabase-js upgraded to latest version with npm list confirmation
All supabase.auth.signIn() calls migrated to signInWithPassword / signInWithOAuth / signInWithOtp
Sync auth methods (session(), user()) replaced with async getSession() / getUser()
Realtime subscriptions migrated from .on() to channel-based API
data/error destructuring updated where return shapes changed
TypeScript types regenerated from current schema
Test suite passing, type checking clean
Rollback branch or version pin documented
Error Handling Error Cause Solution Property 'session' does not existv1 sync .session() removed in v2 Replace with await supabase.auth.getSession() Property 'signIn' does not existsignIn split into multiple methods in v2Use signInWithPassword, signInWithOAuth, or signInWithOtp supabase.auth.api is undefined.api namespace removed in v2Call methods directly on supabase.auth.* TypeError: supabase.from(...).on is not a functionRealtime API replaced in v2 Use supabase.channel().on('postgres_changes', ...) Type errors after gen types Database schema changed between versions Update application code to match new generated types PGRST116 error on .single()Zero rows returned (v2 throws) Use .maybeSingle() for optional lookups ERR_REQUIRE_ESM after upgradev2 is ESM-only in some bundlers Update tsconfig.json to "module": "esnext" or use dynamic import() AuthSessionMissingErrorgetSession() called before auth initializedWrap in onAuthStateChange listener or check session !== null
Examples Full v1 → v2 auth migration (Next.js):
import { createClient } from '@supabase/supabase-js'
import type { Database } from './database.types'
export const supabase = createClient<Database >(
process.env .NEXT_PUBLIC_SUPABASE_URL !,
process.env .NEXT_PUBLIC_SUPABASE_ANON_KEY !
)
export async function login (email : string , password : string ) {
const { data, error } = await supabase.auth .signInWithPassword ({
email,
password,
})
if (error) {
if (error.code === 'invalid_credentials' ) {
return { success : false , message : 'Invalid email or password' }
}
throw error
}
return { success : true , session : data.session }
}
import { useEffect, useState } from 'react'
import { supabase } from '@/lib/supabase'
import type { Session } from '@supabase/supabase-js'
export function useAuth ( ) {
const [session, setSession] = useState<Session | null >(null )
useEffect (() => {
supabase.auth .getSession ().then (({ data: { session } } ) => {
setSession (session)
})
const { data : { subscription } } = supabase.auth .onAuthStateChange (
(_event, session ) => setSession (session)
)
return () => subscription.unsubscribe ()
}, [])
return session
}
from supabase import create_client
supabase = create_client(url, key)
data = supabase.table("users" ).select("*" ).execute()
users = data["data" ]
from supabase import create_client, Client
supabase: Client = create_client(url, key)
response = supabase.table("users" ).select("*" ).execute()
users = response.data
Resources
Next Steps For CI integration with the upgraded SDK, see supabase-ci-integration. For database migration workflows after schema changes, see supabase-migration-deep-dive.