https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • jwt expiry and local supabase
    l

    logemann

    01/30/2023, 12:39 PM
    Is there a way to change JWT expiry time in a local supabase setup? Cant see a setting in the UI.
    • 1
    • 1
  • Potential Supabase Auth Firefox bug?
    h

    Hypps

    01/30/2023, 12:42 PM
    Hi folks! 👋 I'm not quite sure whether this is a bug or if I'm just doing anything wrong? For some reason, whenever I try to auth with azure as the provider I receive "401 Unauthorized: invalid claim: missing sub claim"... It works as expected when using Chrome. Is this a common issue that someone has solved already? 🤔 Super thankful for any kind of help! 🙏
    j
    s
    • 3
    • 5
  • Project duplication
    e

    eloahsam

    01/30/2023, 1:12 PM
    So currently I have a project on Supabase and use it as a Dev playground and I want to duplicate the entire project (tables ,database , trigger , functions , settings ) to create a production project How can I go about this ?
  • Sequential IDs based on another table
    n

    nimo

    01/30/2023, 4:21 PM
    I'd like to setup the following table relationship:
    Copy code
    CREATE TABLE project (
        id uuid primary key,
        project_name text,
        ...
    );
    
    CREATE TABLE interview (
        id uuid primary key,
        notes text,
        project_id uuid
        ....,
        CONSTRAINT fk_project_id
          FOREIGN KEY(project_id)
          REFERENCES project(project_id)
    );
    The relationship is
    project HAS MANY interview
    . I'd like the interview to have a UUID primary key so you can't "guess" how many interviews have been done. But ideally, it would also be sequential on a PER PROJECT basis. Is there an easy way to set this up?
    g
    • 2
    • 12
  • Enable ALL for authenticated admin users
    k

    kyds3k

    01/30/2023, 5:31 PM
    I'm trying to write an RLS policy to allow ALL access to authenticated users whose profile has the "admin" column set to "true" . . . I guess the templates were enough at first but now I need to do something more complicated.
    g
    j
    p
    • 4
    • 58
  • Realtime not working
    p

    philbookst

    01/30/2023, 6:31 PM
    Hey, I'm having trouble getting realtime to work correctly with the v2 js client I'm building a remix app and have this basic setup in my component:
    Copy code
    ts
        const { supabase } = useOutletContext<Context>();
    
        useEffect(() => {
            const jobs = supabase
                .from("jobs")
                .on("*", (payload) => {
                    console.info({ payload });
                })
                .subscribe();
    
            return () => {
                supabase.removeSubscription(jobs);
            };
        }, [supabase]);
    but the payload callback doesn't run at all. Doing a simple select works just fine but the subscription doesn't even tho I see a websocket connection being made in the dev tools - which is stuck in a pending state. I do not have any RLS policies in place if that matters Thanks for your help!
    g
    • 2
    • 9
  • Is it easy to change “noreply@mail.app.supabase.io” to “noreply@myappdomain.com”?
    s

    Smardrengr

    01/30/2023, 6:33 PM
    I'm on the paid plan and have successfully added my custom domain, so the URL redirects are now working from my domain, I'd just like to make the sign-up / reset password sender origins to match my app's domain.
    s
    • 2
    • 1
  • JS: best way to save user data without async fetching every time? to use with nextjs useSWR
    d

    Domcario

    01/30/2023, 7:21 PM
    on each page of my next.js app, i currently do a
    Copy code
    js
    const [user, setUser] = useState(null)
    
    useEffect(() => {
      async function fetchUserInfo() {
        const { data: { user } } = await supabase.auth.getUser()
        if (user) {
          setUser(user)
        }
      }
      fetchUserInfo()
    }, [])
    while trying to implement useSWR (https://swr.vercel.app/), i can't pass in a promised value like
    user.id
    and the fact it defaults to null makes it a little annoying too. is there a better way for me to retain the output of
    supabase.auth.getUser
    throughout my app instead of calling it on each page.
    g
    • 2
    • 7
  • channel.unsubscribe vs supabase.removeSubscription
    c

    c yan ♡

    01/30/2023, 7:23 PM
    Hi, what's the differnece between
    channel.unsubscribe()
    and
    supabase.removeSubscription(channel)
    ?
  • what is the benefits of Supabase for me as a Back-End developer?
    m

    MohammadAlian_2004

    01/30/2023, 7:32 PM
    is there any value for me as a back-end developer to start using supabase?
    b
    • 2
    • 2
  • supabase auth invalid claim: missing sub claim"
    j

    JoshTheNerd

    01/30/2023, 8:01 PM
    Supabase Client. I already checked the credentials
    g
    • 2
    • 26
  • Best practice for edge functions?
    g

    GreenArruh

    01/30/2023, 8:02 PM
    Hello, Currently I have multiple edge functions that are called with varying frequency. I haven't quite released my application publicly yet, but I'm trying to sus out how much cost I'll be incurring. I know the docs say it's better to build bigger functions rather than multiple smaller ones, but I'm kind of wondering to what point that's true. For example, is it more cost/resource efficient to build 1 giant endpoint that has every backend functionality in it, or is it better to separate out some less frequently called functionality into its own endpoint?
  • Does Auth request count as Edge Function invocation?
    u

    1chbinamin

    01/30/2023, 8:19 PM
    I see on free tier that apps can have up to 500K Edge Functions invocations. I'm wondering if Auth request e.g. supabase.auth.signOut() counts as 1 Edge Function or not?
    g
    • 2
    • 4
  • global error handler for entire client
    d

    damian_w

    01/30/2023, 8:51 PM
    Hey guys, for now i use global exception filters in nestJS to catch all errors, there is way to force in entire supabase to throw errors instead of pure error data in error object ? I know there i can pass after every request code like:
    Copy code
    if(error){
    handleError(error)
    }
    But i looking for some global solution. For now i use globally:
    s
    • 2
    • 1
  • How upsert() works with multiple columns ?
    k

    KrishenK 君主

    01/30/2023, 9:13 PM
    Hello! After reading the documentation, that says
    Comma-separated UNIQUE column(s) to specify how duplicate rows are determined. Two rows are duplicates if all the 'onConflict' columns are equal.
    I have got the error : (CODE 42P10)
    there is no unique or exclusion constraint matching the ON CONFLICT specification
    I don't know what is wrong in my configuration. 😰 My tables :
    Copy code
    postgresql
    create table if not exists rooms (
      id uuid default uuid_generate_v4() primary key,
      creator uuid references public.users not null default auth.uid(),
      created_at timestamp with time zone default timezone('utc'::text, now()) not null
    );
    
    create table if not exists songs (
      id bigint generated by default as identity primary key,
      video_id VARCHAR(50) not null UNIQUE,
      user_id uuid references public.users not null default auth.uid(),
      room_id uuid references public.rooms on delete cascade not null UNIQUE,
      created_at timestamp with time zone default timezone('utc'::text, now()) not null,
      voters uuid[]
    );
    My function :
    Copy code
    js
    this.auth.supabase.from('songs').upsert({
          user_id: this.auth.getCurrentUserId(),
          video_id: payload.trackId,
          room_id: this.getRoomId(),
          voters: [this.auth.getCurrentUserId()],
      }, {
          onConflict: 'video_id, room_id',
      }).then(() => {
          console.log('Data sent');
      });
    PS : I think the problem is with the column
    room_id
    because only with video_id, it works. But I can't figure out. I wish your help 🙏
    g
    • 2
    • 3
  • What happens if max concurrent connections is reached?
    t

    Trevvy

    01/30/2023, 10:22 PM
    I'm reading over each tiers specifications, and I see there is a max concurrent connections enforced. So let's say I'm on the free tier, and I have 201 concurrent connections. What happens to the 201nd connection. Does it straight up fail, or is there someway to handle this? I'm currently using my own server, but am thinking about possibly switching to Supabase. For example, I run a social app, which the users request an API endpoint, which returns the recent post. I could have 1000 users request this at any given moment. And in that case, am I right in thinking that Supabase could not handle this, on their basic plan?
    g
    • 2
    • 8
  • Check if user has SELECT access to this specific row?
    a

    akella

    01/30/2023, 10:54 PM
    In my project i need to sell access to videos. They are stored in VIDEOS table:
    (video_id,video_URL)
    . I also have a PURCHASES table:
    (user_id, video_id)
    where user_id is a foreign key from auth. When i load the video-page i do this now:
    Copy code
    javascript
    const { data } = await supabase
          .from('*VIDEOS*')
          .select("*")
          .eq("video_id", id);
    Is there a way to check if current user has access to this particular video_id? So i imagine, i would create a policy in RLS to check if user can get this content. But i dont have my current SQL query parameters there right? I dont have video_id - to look up my purchases table. What do you think is the best way to solve this problem? May be RLS is the wrong tool for this case?
    g
    • 2
    • 2
  • Syntax help using .or with .ilike in Supabase Client
    m

    maglev

    01/30/2023, 11:26 PM
    Hi, I'm trying to do an
    or
    operation like this using the Supabase Client: `.or(
    first_name ILIKE '%str%', last_name ILIKE '%str%'
    )` to return results if the string inside
    %%
    is contained in the first_name and/or last_name column. What would be the correct way of writing this part? Thanks.
    g
    • 2
    • 16
  • Sign In With Google O Auth Not Working Supabase Next.js
    h

    Holland

    01/30/2023, 11:49 PM
    *Problem * When I sign in With Google, await supabaseClient.auth.getUser() does not return a user. Steps 1. Call signInWithOAuth
    Copy code
    const { data, error } = await supabaseClient.auth.signInWithOAuth({
      provider: 'google',
    })
    2. Attempt to get user
    Copy code
    const userInfo = await supabaseClient.auth.getUser()
    3. Get error message
    Copy code
    data: {user: null}
    error: AuthApiError: invalid claim: missing sub claim at eval (webpack-internal:///.
      name:"AuthApiError"
      status: 401
      __isAuthError: true
      message:"invalid claim: missing sub claim"
      stack: "AuthApiError: invalid claim: missing sub claim
        at eval (webpack-internal:///./node_modules/@supabase/gotrue-js/dist/module/lib/fetch.js:49:20)"
    What I am using I am using Next.js. I installed the following:
    Copy code
    @supabase/auth-helpers-nextjs
    @supabase/auth-helpers-react
    @supabase/auth-ui-react
    Note Logging in and signing up with email and password work fine for me. I call signUp to create a user with email and password and signInWithPassword to log them in with email and password. Calling supabaseClient.auth.getUser() after logging in with email and password returns a user for me. I am confused on how to actually impliment a signup with google. As I only see the function for signInWithGoogle(). How do I signin and signup with google?
    g
    • 2
    • 3
  • Introduction to accessing supabase with C#
    r

    ramon

    01/31/2023, 12:23 AM
    Hi all, Intro question regarding C# and supabase. I’m totally new to web related programming with c#, but a web developer friend of mine pointed me towards supabase. (For context I am trying to use supabase to host a database with architectural floorplans that will interact with some custom 3D software and components I am building.) I’m trying to follow the documentation on the c# components (and think) that I successfully connected to my database. However it is unclear to me how I can specify how to access a specific table / project from my API. Image 1 copying the code from the https://supabase.com/docs/reference/csharp/select help file Where is from or specified there in the examples? And what would I need to do? Image 2: My own database is a simple table with int, float and json entries. So how could I for instance access all items in the Table 'gramercy' that have an area of 30 ? Thanks a lot for your help! Ramon
    g
    u
    • 3
    • 6
  • passwordless sign up with email/number
    c

    chungus

    01/31/2023, 1:35 AM
    it seems like the supabase sdk, namely
    signUp
    requires you to attach a
    password
    field. however, if the desired flow is more 1. enter phone in sign up flow 2. receive OTP 3. verify signup with OTP 4. sign the user in with session/refresh this looks more like something we need to stitch together ourselves. namely 1. create a user with
    insert
    2. call
    verifyWitOTP
    3. collect and input challenge to receive session 4. delete the user if OTP fails/times out/user quits however, this seems like a code smell. is there a specific security reason why we can't sign users up after they complete their first OTP challenge?
    • 1
    • 1
  • create policy if it doesn't exist?
    j

    JamesB

    01/31/2023, 1:37 AM
    Is it possible to create a policy only if it doesn't exist?
    Copy code
    sql
    create policy if not exists "abc" ....
    does not seem to work.
    s
    • 2
    • 2
  • Time Sensitive: "Failed to upload x.csv. The object exceeded the maximum allowed size"
    j

    Jonathan Leung

    01/31/2023, 1:58 AM
    Hi y'all I'm trying to meet a deadline tonight! I have some files I'm uploading into a storage bucket and for files < 50MB, I don't get this error. But then I just upgraded to the pro plan, which on the pricing page says I can upload files of size 5GB, but I'm still getting this error for files > 50MB but not for files < 50MB.
    g
    • 2
    • 11
  • service_role key vs admin user in Next.js API routes
    d

    Decaf Coffee

    01/31/2023, 2:33 AM
    Hi everyone, I'm new to supabase and postgresql and I want to get a sense of conventions / intended use cases in this scenario. I'm building an app where the backend has elevated privileges to perform operations on the database. Are there best practice on using the service_role key or creating a special "admin" user that backend would login as to perform the operations? Are there better options out there I'm not thinking about and do you have a preference for your projects? Thanks in advance
    g
    • 2
    • 1
  • Unable to Exchange Server Code - Self Hosted
    a

    Anarki

    01/31/2023, 2:48 AM
    I am attempting to self host an instance of supabase that connects to keycloak oauth. When I attempt to login I get to the keycloak login and once I login my url shows that it was unable to exchange server code and my app does not login. I’m assuming my redirects are not correct. In keycloak client I have the redirect url set to http://localhost:8000/auth/v1/callback I also set the redirect url in the supabase Docker compose file to http://localhost:8000/auth/v1/callback Would it be possible to get an example of a working config for supabase and keycloak? Both being self hosted on a local machine. I am using a boilerplate app just to test out the auth flow.
  • [auth-helpers] | SyntaxError: Unexpected token 'export'
    j

    JoshTheNerd

    01/31/2023, 3:09 AM
    I'm not sure why but
    line 15
    causes the above console error
    h
    s
    • 3
    • 26
  • Filter by both the current and foreign table - using .or() ? Inconsistency with other filters
    m

    morgan

    01/31/2023, 5:46 AM
    I'm trying to create a filter needs to check both the current table and the foreign table using the
    or()
    filter. (match atleast one filter). However it doesn't seem possible with the use of
    foreignTable
    { foreignTable: 'cities' }
    , since it forces that table within the filter. https://supabase.com/docs/reference/javascript/or What I want to achieve would look like this:
    Copy code
    const { data, error } = await supabase
      .from('countries')
      .select(`
        name,
        cities!inner (
          name
        )
      `)
      .or('cities.country_id.eq.1,name.eq.china,name.eq.denmark')
    This would work just like other inner joins (https://supabase.com/docs/reference/javascript/using-filters) Maybe we can get rid of need for
    foreignTable
    on the
    or
    filter in future versions? If there's a workaround please let me know. Thank you ☺️
    • 1
    • 1
  • With sb auth, is there a way to distinguish between signin vs signup?
    r

    rimraf

    01/31/2023, 6:10 AM
    I'd like to create a user profile upon true signup (new user created) without using db trigger. Is there an js event or a value in the decoded JWT that can be used to deduce that a new user record has been created?
    s
    • 2
    • 2
  • Creating new users error: "Database error saving new user"
    n

    nlst

    01/31/2023, 6:22 AM
    We can't add new users on our app or the Supabase dashboard because there's a "database error". Something like this: "Failed to invite user: failed to make invite request: Database error saving new user" What does this actually mean, and how could we fix it? Restarting the database does not fix the problem.
    g
    s
    • 3
    • 8
  • Default value for text array
    e

    elliott

    01/31/2023, 7:52 AM
    How do I set a default value for a text array in the supabase UI? If I set it like ["a", "b", "c"]. I get the error "malformed array literal". I can not figure out how to get around this.
    g
    h
    g
    • 4
    • 9
1...114115116...230Latest