refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] Using different schema for Supabase prevents build, results in error

Open damywise opened this issue 1 year ago • 3 comments

Describe the bug

Heya, I'm having trouble trying to use different table schema using Supabase for the template refine project

// utility/supabaseClient.ts
export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
    db: {
// problematic part vv
        schema: "custom",
    },
    auth: {
        persistSession: true,
    },
});

That exact code results in the following error.


22:08:57.278    Executing user command: npm run build
22:08:57.892    
22:08:57.892    > [email protected] build
22:08:57.892    > tsc && refine build
22:08:57.892    
22:09:02.920    src/App.tsx(328,48): error TS2345: Argument of type 'SupabaseClient<any, "custom", any>' is not assignable to parameter of type 'SupabaseClient<any, "public", any>'.
22:09:02.921      Type '"custom"' is not assignable to type '"public"'.
22:09:02.921    src/App.tsx(329,48): error TS2345: Argument of type 'SupabaseClient<any, "custom", any>' is not assignable to parameter of type 'SupabaseClient<any, "public", any>'.
22:09:02.967    Failed: build command exited with code: 2
22:09:03.827    Failed: error occurred while running build command

Steps To Reproduce

  1. Get the Supabase refine template
  2. Change supabaseClient options schema from "public" to anything else
  3. npm run build
  4. Error

Expected behavior

works

Screenshot

No response

Desktop

No response

Mobile

No response

Additional Context

No response

damywise avatar Sep 19 '23 15:09 damywise

Hello @damywise this issue isn't related to refine and coming from supabase library.

You can check the following discussion on possible cause: https://github.com/orgs/supabase/discussions/1222

Best.

BatuhanW avatar Sep 19 '23 16:09 BatuhanW

Hey @damywise, sorry for the issue! I've just checked and encountered the same issue when provided a different schema than public. It looks like the SupabaseClient type we expect in dataProvider and liveProvider methods of @refinedev/supabase has unintended generic type fallbacks. We can update it like SupabaseClient<any,any,any> to make sure it allows custom schemas.

If you want to work on this issue, we're welcoming all contributions 🙏 Check out the Contributing guide to get started!

I've added this task to our backlog but not sure if we can provide a fix for the next release.

aliemir avatar Dec 19 '23 10:12 aliemir

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 17 '24 11:02 stale[bot]