createServerClient deprecation incongruence
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When folllowing the documentation for the SSR client, TypeScript complains about deprecation.
The signature '(supabaseUrl: string, supabaseKey: string, options: SupabaseClientOptions<"public"> & { cookieOptions?: CookieOptionsWithName | undefined; cookies: CookieMethodsServerDeprecated; cookieEncoding?: "raw" | ... 1 more ... | undefined; }): SupabaseClient<...>' of 'createServerClient' is deprecated.ts(6387)
createServerClient.d.ts(4, 4): The declaration was marked as deprecated here.
Expected behavior
I expect the type definitions on the library to be congruent with the official documentation
System information
- OS: MacOS
- Version of supabase-js:
latest - Version of supabase-ssr:
latest - Version of Node.js: 24.11
Additional context
It also seems that you're deprecating cookieOptions which is insane since we need to be able to specify the cookie name.
Hi @voltuer π Its seems a bit confusing but your LSP is probably handling it wrong π
What happened?
The createServerClient() has changed its signature and a override method was introduced, so there's actually 2 versions of this function:
// @deprecated Please specify `getAll` and `setAll` cookie methods ...
export declare function createServerClient({
cookieOptions?: CookieOptionsWithName,
cookies: CookieMethodsServerDeprecated, // <--- This one changed
cookieEncoding?: "raw" | "base64url"
})
// The new one:
export declare function createServerClient({
cookieOptions?: CookieOptionsWithName,
cookies: CookieMethodsServer, // <--- New type
cookieEncoding?: "raw" | "base64url",
})
How to fix?
You need to make sure that your code is using the new version of cookies object:
const supabase = createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
{
cookies: {
- get(name) {
+ getAll() {
return request.cookies.getAll();
},
- set(name) {
+ setAll(cookiesToSet) {
// ...
}
}
Try to restart your IDE, as well clean your node_modules folder, maybe delete your pnpm-lock.yaml file too
Neovim
https://github.com/user-attachments/assets/aa97e0f5-ca7b-4f36-9c53-b484ba5efa49
like you can see, all errors disappear after changing the cookies object as well the inline docs changed
Try to restart your IDE, as well clean your
node_modulesfolder, maybe delete yourpnpm-lock.yamlfile too
I did all that and the warning just won't go away. I don't get it.
Hi @CoolOppo π May you check if your code is using the older method overload? Like I did suggest in my previous comment?
@CoolOppo I can affirm that the issue has not been resolved on my end as well, and like @kallebysantos pointed out, there're two versions of the createServerClient function existing, and one seems to be overloading the other in a not so great way, and there's no way to tell whcih method my code is using.
We would love if this could be looked at, thank you @kallebysantos ππΎ
Hi @CoolOppo @Olulanke-Mainasara I can confirm the warning is reproducible, & @kallebysantos's suggestion fixes it!
If the issue still persists, try:
- Delete
node_modules& reinstall - Restart TS server
Thank you very much @7ttp and @kallebysantos ππΎ
And for anyone still having the issue, even after following the suggestions, all you need to do is just update the @supabase/ssr package, and the incongruence would be resolvedπ―