https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Lots of TOKEN_REFRESHED events after SIGNED_IN
    j

    Jason Creviston

    08/30/2022, 5:21 PM
    What triggers the
    TOKEN_REFRESHED
    event? I'm getting several of them shortly after an OAuth login. Not only that, but localStorage never updates with the new access and refresh tokens. In the supabase gui, the original refresh token is revoked. Inside
    onAuthStateChange()
    , I
    console.log(event, session?.refresh_token)
    This is the output from my last login. I'm using the v2 release candidate.
    Copy code
    SIGNED_IN nLwJt-yoM2VWVS7bG9p3XA
    TOKEN_REFRESHED
    TOKEN_REFRESHED
    TOKEN_REFRESHED
    TOKEN_REFRESHED
    TOKEN_REFRESHED
    TOKEN_REFRESHED
    TOKEN_REFRESHED
    TOKEN_REFRESHED
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
    • 1
    • 1
  • Create `Database Webhook` on `auth.users` ?
    c

    connection01

    08/30/2022, 5:21 PM
    Is it not possible to create
    Database Webhook
    on
    auth.users
    ?
    g
    • 2
    • 7
  • (solved) Realtime subscriptions not working with RLS?
    o

    olegkorol

    08/30/2022, 5:26 PM
    It seems that Realtime subscriptions are not working properly with some RLS policies. They work as supposed if RLS is completely disabled. Normal queries (not subscriptions), e.g. SELECT work as expected w/ and w/o RLS policies. Maybe I am missing something here. For example:
    Copy code
    javascript
    import { supabaseClient } from '@supabase/auth-helpers-nextjs' // version 0.2.7
    
    // [...]
    
    useEffect(() => {
        const subscription = supabaseClient
          .from('TABLE_NAME')
          .on('*', async (payload) => {
              // do something...
            }
          )
          .subscribe()
    
        return () => {      supabaseClient.removeSubscription(subscription)
        };
    
      }, []);
    
    // [...]
    If I try to apply a simple RLS policy, like the following, the subscription above does not work anymore:
    Copy code
    sql
    CREATE POLICY "TEST_POLICY" ON "public"."TABLE_NAME"
    AS PERMISSIVE FOR ALL
    TO public
    USING (auth.uid() = user_id)
    WITH CHECK (auth.uid() = user_id)
    Any ideas?
    g
    • 2
    • 18
  • TypeError supabaseClient.auth.session is not a function
    u

    매튜

    08/30/2022, 6:14 PM
    Error while using supabase auth ui with supabase-js v2.0.0. Any help would be much appreciated.
    g
    t
    s
    • 4
    • 8
  • Advanced role systems similar to discord
    l

    Logicpoints

    08/30/2022, 7:05 PM
    Hey, I'm creating a chat app which shares a lot of features with Discord for a client. specifically, the roles feature I want to create dynamic roles that can be added to users that allow the users to do certain actions in certain channels. For example, a role called "Advanced" would allow users to add reactions to messages in Channel A and Channel B, or create threads in Channel B, depending on configuration set by chat admins. I'm wondering how to set up access policies for this. Here's where I'm heading... I'd create these tables... *
    role
    table with
    id
    and
    name
    *
    role_user_assignment
    table with
    role_id
    ,
    user_id
    to give a user a role *
    role_channel_permission
    table with
    permission
    enum
    "react" "reply_in_thread"
    and pointer to
    channel_id
    ,
    role_id
    to give users of a certain role a permission in a certain channel. So for example to check if user can create a reaction to a message in a channel... I'd have role named "Reactors" with an assignment to a user, and there'd be a role_channel_permission for permission to "react" on Reactors role_id in a given channel. Then the question is how to model the row level security for this? I want to only allow insertion of the
    message_reaction
    on a message for users who have a role that has a role_channel_permission in the given channel to
    "react"
    . Anyone have any examples of these "nested access policies with joins"? Otherwise I know i could just write supabase functions to do this but it seems like something I could model with access policies...
    g
    • 2
    • 1
  • Using supabase with EdgeDB
    l

    Logicpoints

    08/30/2022, 7:13 PM
    I like the look of supabase but I'd like to use EdgeDB as my schema definition language. There should be no issue with these two working together right?
    s
    • 2
    • 3
  • Is supabase ready for scalable web applications?
    d

    Deleted User

    08/30/2022, 7:36 PM
    I was recently using SvelteKit in combination with Supabase and I absolutely love it. What do you think about this point: Is supabase ready for a large application which highly scales up? Self hosted.
  • (Solved) Project migrate fails
    c

    connection01

    08/30/2022, 7:47 PM
    I am using this guide to move my project At step 5 I get the following error.
    Copy code
    psql -d $NEW_DB_URL -U postgres -f dump.sql
    psql: error: connection to server at "db.xxxxxxxxxxxxxx.supabase.co" (3.88.156.105), port 6543 failed: FATAL:  SASL authentication failed
    connection to server at "db.xxxxxxxxxxxxxx.supabase.co" (3.88.156.105), port 6543 failed: FATAL:  SASL authentication failed
    g
    • 2
    • 2
  • How to properly set default values?
    w

    wieli99

    08/30/2022, 9:16 PM
    Hi, I'm trying to set a default url for my api calls. The col is nullable in the database and I set a default value; however when I insert via the js api without specifying the col it jest gets inserted as null. How do I properly do this?
    g
    j
    • 3
    • 11
  • I get session data without cookies
    u

    Ulriken

    08/30/2022, 10:14 PM
    I've been testing the supabase for a while and the auth system confusing me a bit. I sign in the user on the server with
    supabaseClient.auth.signIn({email, password})
    And then when I do
    supabaseClient.auth.session()
    on the server upon page request, I get the session. However, there is no cookie or local storage set on the browser. Then when I visit my dev server's address on another browser (Safari) and I get the session. I even get the session on incognito mode. So, how does this actually work? I don't even pass anything to
    supabaseClient.auth.session()
    This must be coming from the supabase server, but then how can I sign-in multiple users? I am a bit confused
  • How to expose auth.users to admins?
    j

    jxyz

    08/30/2022, 10:20 PM
    If I have an admin (thru RLS or Claims), and the supabase client schema is 'public', how can I access the 'users' table in the 'auth' schema?
    g
    • 2
    • 2
  • Real Time Question
    a

    Anddy

    08/30/2022, 10:38 PM
    How do i basically set a timeout for this so i dont have this run every second pinging to the server. Thanks in advance
    Copy code
    js
    useEffect(() => {
        async function loadProfile() {
          const { id, created_at, user_id, username, karma, avatar } =
            await getProfile();
          setProfile({ id, created_at, user_id, username, karma, avatar });
          await client
            .from('*')
            .on('*', async (payload) => {
              const { id, created_at, user_id, username, karma, avatar } = await getProfile();
              setProfile({id, created_at, user_id, username, karma, avatar});
            })
            .subscribe();
        }
        loadProfile();
      }, [profile]);
    g
    • 2
    • 7
  • Supabase Functions only supports POST requests?
    j

    jxyz

    08/30/2022, 11:31 PM
    At it says "Supabase Functions only supports POST requests.". Does that mean I cannot send GET, PUT, PATCH, DELETE on Supabase paths? Is there a reason behind this hard limit?
    g
    • 2
    • 1
  • Login using username instead of email
    s

    SchneckchenAndy

    08/31/2022, 12:01 AM
    Is it possible to switch to username login instead of requiring a valid email?
    g
    • 2
    • 2
  • Could not find a relationship between 'products' and 'prices'
    l

    Light

    08/31/2022, 12:22 AM
    I have two tables products and prices. Prices has a foreign key relation to products with
    product_id text references products
    Copy code
    await supabase
        .from('products')
        .select('*, prices(*)')
    When I try this query it says
    Could not find a relationship between 'products' and 'prices' in the schema cache
    I am doing this join correctly?
    g
    • 2
    • 12
  • Saas Template
    j

    jon.m

    08/31/2022, 1:09 AM
    Hello, I’m looking for a SaaS starter template to use as a reference. Something like a SQL set up or tutorial. Any suggestions? I’m particularly interested in how to handle multiple organizations that have more than one user.
  • Row Level Security Prevent Update Specific Field
    a

    Aris Ripandi

    08/31/2022, 1:23 AM
    Hello folks! Is it possible to create RLS for disabling specific column? In this case I want to prevent
    created_at
    column to be updated. If possible, can anyone give me an example? Thanks.
    g
    • 2
    • 1
  • Hourly Authentication Limits on Password Sign-ins
    s

    subwaymatch

    08/31/2022, 2:12 AM
    Hello! Is there a limit on the number of hourly sign-ups and sign-ins using passwords? For example, does the 30 emails/hour limit apply to reset passwords and email confirmation as well? Thank you!
    s
    • 2
    • 1
  • About auth-Setting own credentials
    f

    fernandops26

    08/31/2022, 2:14 AM
    How I can set my credentials (access_token and refresh_token) on the supabase-js client (next version)?
    s
    • 2
    • 3
  • FetchError Request with GETHEAD method cannot have body.
    c

    chientrm

    08/31/2022, 2:15 AM
    If I use
    select
    there's no error. However, if I use
    select
    right after a
    upsert
    . This error occur
    s
    • 2
    • 1
  • Realtime Connectivity
    b

    Borisdm

    08/31/2022, 3:42 AM
    Is this a normal thing for supabase ws connections to do?
  • 2 Queries vs 1 - Conceptual Question
    l

    luke90275

    08/31/2022, 3:52 AM
    How much more efficient (if at all) would running a single query with a join be than running 2 seperate queries and manually joining them on the client? And when I talk about efficiency, I mean more in terms of supabase bandwidth used (as that's what I'm being charged for) as opposed to the speed of the response time. Also, somewhat related but how expansive is supabase's free tier? It's a little unclear as pricing is in terms of bandwidth.
  • (solved) hcaptcha request disallowed
    i

    Isological

    08/31/2022, 4:46 AM
    I am trying to enable Enable hCaptcha protection and have setup the secret key and passed the correct token via supabase-js. However, even though everything is setup correctly I keep getting "request disallowed" Just to make sure I have even verified the token I pass to the supabase-client manually with hCaptcha and got "success": true Any ideas on how I should debug this? It does not seem to be an error on my side.
    s
    • 2
    • 9
  • Get project ref from SQL?
    a

    ak4zh

    08/31/2022, 5:47 AM
    Is project-ref-id stored in any table inside the postgresql? I want to get the current project-ref-id using SQL. This is to make a generic SQL query which needs project-ref-if, so I can run same sql in any project.
    EXEUTE function do_something(SELECT project_ref_id FROM some_table)
    s
    • 2
    • 1
  • (solved) Webhook not working
    f

    Fainaru

    08/31/2022, 5:57 AM
    I try to enter a data to call a url and it does not work, it seems that the trigger does not work because due to insomnia it works for me
    o
    u
    • 3
    • 7
  • Noob foreign keys q – table of venues and table of reviews, how best to link?
    f

    felixthehat

    08/31/2022, 10:16 AM
    Hi, I have a table of
    restaurants
    with metadata (name, address etc) and a table called
    reviews
    – I'd like when I query the
    restaurants
    table to pull in relevant
    reviews
    . In which table should I add a foreign key column? Both? Should the
    reviews
    table have a foreign key column with the restaurant ID in it? Bit confused on the best approach, thanks! Note – I only plan one review/row per restaurant if that helps
    o
    • 2
    • 2
  • Return data from insert()?
    s

    Shaf

    08/31/2022, 10:57 AM
    const { data, error } = await supabase .from('users') .insert([ { some_column: 'someValue' }, { some_column: 'otherValue' }, ]) does the method above actually return data? if so how come im getting undefined for that data after calling the function. Am i missing something? NOTE: I tried both insert() and upsert(), I also tried to pass upsert as a parameter to insert() NOTE: the data is being added to the table with no issues.
    o
    s
    • 3
    • 2
  • How can I get the Alpha role if I've been a long-time user of Supabase?
    j

    JTmaveryk

    08/31/2022, 12:17 PM
    I've been a long time member of Supabase and am just discovering and joining the discord server now, wondering if there was any chance I could get the "Alpha" role?
    o
    • 2
    • 5
  • What VSCode Setup do you use?
    p

    psteinroe

    08/31/2022, 12:55 PM
    Hey! I am using vs code to develop for supabase and I am having troubles finding a good setup for writing migrations. What extensions and settings do you use? I am also open to switch editors if there is one that supports postgresql syntax, auto completion, code formatting etc... @User is Oliver Rice (maintainer of pg_graphql) around? I guess he as written plenty of sql in the past months and maybe has a few tips?
    i
    s
    • 3
    • 4
  • Subscription not working after refactor
    k

    KTibow

    08/31/2022, 3:36 PM
    I recently refactored some of my code and added more RLS, but now subscriptions aren't working. The subscription status callback gives me
    SUBSCRIPTION_ERROR
    with
    { reason: ":error" }
    . What does this mean? What can I do to debug?
    g
    • 2
    • 46
1...121314...230Latest