Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading types to @supabase/[email protected] raises type errors #541

Open
oof2win2 opened this issue Nov 25, 2024 · 7 comments
Open

Upgrading types to @supabase/[email protected] raises type errors #541

oof2win2 opened this issue Nov 25, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@oof2win2
Copy link

oof2win2 commented Nov 25, 2024

Describe the bug
There are type errors when using @supabase/ssr instead of @supabase/supabase-js when installing all on @latest

Argument of type 'SupabaseClient<Database, "public", { Tables: { ai_assistant: { Row: { assistant_id: string; color: string; description: string; emoji: string; example_messages: string[]; id: number; image_url: string; premium: boolean; slug: string; tags: string[]; title: string; }; Insert: { ...; }; Update: { ...; }; Relationships...' is not assignable to parameter of type 'SupabaseClient<any, "public", any>'.
  Property 'supabaseUrl' is protected but type 'SupabaseClient<Database, SchemaName, Schema>' is not a class derived from 'SupabaseClient<Database, SchemaName, Schema>'.

To Reproduce

Install the following dependencies:

dependencies:
@supabase-cache-helpers/postgrest-swr 1.10.1
├─┬ @supabase-cache-helpers/postgrest-core 0.8.1
│ ├── @supabase/postgrest-js 1.17.5 peer
│ └─┬ @supabase/supabase-js 2.45.6 peer
│   └── @supabase/postgrest-js 1.16.3
└── @supabase/postgrest-js 1.17.5 peer
@supabase/ssr 0.5.2
└─┬ @supabase/supabase-js 2.45.6 peer
  └── @supabase/postgrest-js 1.16.3
@supabase/supabase-js 2.45.6
└── @supabase/postgrest-js 1.16.3

Use the createBrowserClient instead of createClient

Expected behavior
It works normally without type errors. I tried installing latest and matching versions for everything but it just doesn't work.

@oof2win2 oof2win2 added the bug Something isn't working label Nov 25, 2024
@psteinroe
Copy link
Owner

thanks for reporting! I did not check what version of supabase-js the ssr package uses before upgrading to latest, sorry!

can you try to install [email protected]?

@damien-schneider
Copy link
Contributor

Are you sure this issue is related to @supabase/ssr? I’m currently using @supabase/[email protected], and it works well for www.modul.day. However, this seems related to the following issue mentionned in supabase-cache-helpers #509.

It’s not working effectively for me either with [email protected], which relies on postgrest-js versions above 1.17.x. These versions seem to have different type definitions, potentially causing the problem.

@oof2win2 Could you try with the "@supabase/supabase-js": "2.46.1" and "@supabase/postgrest-js": "1.16.3"and tell me if you still have the errors to check if the problems comes from there ?

@oof2win2
Copy link
Author

@psteinroe Updating to [email protected] sadly did not fix the issue

@damien-schneider with the changed dependencies it works - don't understand how a minor update on supabase-js caused a downgrade on postgrest-js, that's an issue to raise with the Supabase team though.

Thank you for the help 👍

@damien-schneider
Copy link
Contributor

I’m glad it helped! 🙂

However, I believe the issue shouldn’t be closed just yet. It’s not specifically an error with @supabase/ssr, but rather a type error introduced by the postgrest-js 1.17.x upgrade. This issue should still be addressed. Perhaps renaming it to better reflect the type error would provide clearer context.

@oof2win2 oof2win2 changed the title Incompatible with @supabase/ssr Upgrading types to @supabase/[email protected] raises type errors Nov 25, 2024
@oof2win2
Copy link
Author

I think it's clearer now. Would internally pinning the types to @supabase/postgrest-js@1 help?

@oof2win2 oof2win2 reopened this Nov 25, 2024
@boompikachu
Copy link
Contributor

downgrading @supabase/postgrest-js to 1.16.3 works for me

    "@supabase-cache-helpers/postgrest-swr": "^1.10.5",
    "@supabase/postgrest-js": "~1.16.3",
    "@supabase/ssr": "^0.5.2",
    "@supabase/supabase-js": "^2.47.2",

@damien-schneider
Copy link
Contributor

downgrading @supabase/postgrest-js to 1.16.3 works for me

    "@supabase-cache-helpers/postgrest-swr": "^1.10.5",
    "@supabase/postgrest-js": "~1.16.3",
    "@supabase/ssr": "^0.5.2",
    "@supabase/supabase-js": "^2.47.2",

Yes this is the solution for now, but we will have to upgrade to new versions of postgrest-js one day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants