-
-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
@supabase/ssr fails to resolve module imports when using pnpm as package manager, causing "Module not found: Can't resolve '@supabase/ssr'" error during Next.js compilation. The same project works perfectly with Bun package manager.
To Reproduce
- Followed the official Next.js + Supabase quickstart: https://supabase.com/docs/guides/getting-started/quickstarts/nextjs
- Used pnpm instead of npm for package management
- Implemented the exact code from the documentation for server client
- Run
pnpm dev - See compilation error
Exact code from documentation that fails:
// src/utils/supabase/server.ts
import { createServerClient } from '@supabase/ssr'
import { cookies } from 'next/headers'
export async function createClient() {
const cookieStore = await cookies()
return createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{
cookies: {
getAll() {
return cookieStore.getAll()
},
setAll(cookiesToSet) {
try {
cookiesToSet.forEach(({ name, value, options }) =>
cookieStore.set(name, value, options)
)
} catch {
// The `setAll` method was called from a Server Component.
// This can be ignored if you have middleware refreshing
// user sessions.
}
},
},
}
)
}Expected behavior
The @supabase/ssr module should resolve correctly with pnpm, following the official documentation should work regardless of package manager.
Actual behavior
⨯ ./src/utils/supabase/server.ts:1:1
Module not found: Can't resolve '@supabase/ssr'
> 1 | import { createServerClient } from '@supabase/ssr'System information
· OS: Windows
· Browser: Brave (server-side compilation error)
· Version of @supabase/ssr: latest 0.7.0
· Version of Node.js: 22.19.0
· Package manager: pnpm (fails) / Bun (works)
Additional context
· Documentation followed: Official Next.js quickstart guide
· Package manager comparison:
· ❌ Fails with pnpm (following docs exactly)
· ✅ Works with Bun (same code, same project)
· Next.js version: 16.0.1
· Error occurs during: Server-side compilation in Next.js dev server
· Impact: Cannot use official Supabase documentation with pnpm package manager
Workaround: Switching to Bun package manager temporarily resolves the issue, but this prevents teams standardized on pnpm from using Supabase with Next.js.