-
Notifications
You must be signed in to change notification settings - Fork 484
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't workingsupabase-jsRelated to the supabase-js library.Related to the supabase-js library.
Description
Describe the bug
After upgrading to @supabase/supabase-js@2.74.0
, type inference completely breaks when using createServerClient
from @supabase/ssr@0.5.2
. All query results are typed as never
, making the library unusable with TypeScript.
Note: The issue does NOT occur with the regular createClient
from @supabase/supabase-js
- only with createServerClient
from @supabase/ssr
.
Library affected
supabase-js
Reproduction
No response
Steps to reproduce
Environment:
@supabase/supabase-js
:2.74.0
@supabase/ssr
:0.5.2
- supabase cli: 2.48.3
- TypeScript:
5.9.2
- Node:
22.12.0
Minimal reproduction:
import { createServerClient } from "@supabase/ssr"
import type { Database } from "./database.types" // Generated with `supabase gen types typescript`
const supabase = createServerClient<Database>(
process.env.SUPABASE_URL!,
process.env.SUPABASE_ANON_KEY!,
{
cookies: {
getAll() { return [] },
setAll() { /* no-op */ },
},
}
)
async function example() {
// TypeScript error: All operations return 'never' type
const { data } = await supabase
.from("my_table")
.select("id, name")
.single()
// Error: Property 'id' does not exist on type 'never'
console.log(data.id)
// Error: Argument of type '{ name: string }' is not assignable to parameter of type 'never'
await supabase.from("my_table").insert({ name: "test" })
// Error: Argument of type '{ arg: string }' is not assignable to parameter of type 'never'
await supabase.rpc("my_function", { arg: "value" })
}
TypeScript errors:
node_modules/@supabase/ssr/dist/main/createServerClient.d.ts:13:30 - error TS2344:
Type 'SchemaName' does not satisfy the constraint
'{ PostgrestVersion: string; } | (string & Exclude<keyof Database, "__InternalSupabase">)'.
Additionally, all query methods show:
.from()
calls:PostgrestFilterBuilder<..., never, never, ...>
.insert()
expects parameter of typenever
.rpc()
expects parameter of typenever
- Result
data
is typed asnever
Additional context
Workaround: Downgrading to @supabase/supabase-js@2.58.0
resolves the issue:
npm install @supabase/supabase-js@2.58.0 --save
Observation:
- The issue appears to be a compatibility problem between
@supabase/ssr@0.5.2
(released August 2025) and the type changes insupabase-js@2.74.0
- The TypeScript error mentions
Exclude<keyof Database, "__InternalSupabase">
which suggests v2.74.0 expects a__InternalSupabase
key in the Database type that wasn't required before - The CLI-generated types from
supabase gen types typescript
do not include an__InternalSupabase
key - The newer
@supabase/ssr@0.7.0
(released August 22, 2025) was supposed to handle this according to PR #123, but upgrading to it still fails with similar type errors
Related:
- fix: remove usage of internal type params ssr#123 - "fix: remove usage of internal type params"
- feat: reland postgrest 13 support #1537 - "feat: reland postgrest 13 support"
It appears PR #1537 may not have been included in the v2.74.0 release, despite being merged on August 21, 2025.
System Info
System:
OS: Windows 11 10.0.26100
CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900H
Memory: 13.92 GB / 31.64 GB
Binaries:
Node: 22.12.0 - C:\Users\d.band\AppData\Local\Volta\tools\image\node\22.12.0\node.EXE
Yarn: 4.6.0 - C:\Users\d.band\AppData\Local\Volta\tools\image\yarn\4.6.0\bin\yarn.CMD
npm: 10.9.0 - C:\Users\d.band\AppData\Local\Volta\tools\image\node\22.12.0\npm.CMD
pnpm: 10.12.1 - C:\Program Files\Volta\pnpm.EXE
Deno: 1.43.6 - C:\Users\d.band\.deno\bin\deno.EXE
Browsers:
Chrome: 141.0.7390.55
Edge: Chromium (141.0.3537.57)
Internet Explorer: 11.0.26100.1882
npmPackages:
@supabase/ssr: ^0.5.2 => 0.5.2
@supabase/supabase-js: ^2.74.0 => 2.74.0
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Supabase JS Library issue and not an issue with the Supabase platform. If it's a Supabase platform related bug, it should likely be reported to supabase/supabase instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingsupabase-jsRelated to the supabase-js library.Related to the supabase-js library.