https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Users table doesn't exist in Database tab
    a

    Aviv

    09/04/2022, 9:01 AM
    Hey guys, I want to edit my users table in auth.users, but it doesn't exists in the "Database" tab. Where can I find it?
    t
    a
    • 3
    • 4
  • ID (int8) last 2 digits are 0
    d

    dhruv_casa

    09/04/2022, 10:38 AM
    I'm facing a strange issue where I have an int8 id and it is storing the correct id in supabase but when I read the object, the ID contains 00 as the last 2 digits
    g
    • 2
    • 2
  • is there any way to give the new user a ID that defined by the code?
    a

    AlbertGao

    09/04/2022, 10:51 AM
    for example, i would like to have a user id as "user_ksuid" rather than int or uuid, is it possible, currently, after calling signUp, the user entity is created with the uuid already
    s
    g
    • 3
    • 17
  • Supbase local development not working
    u

    현우Hyeon

    09/04/2022, 10:59 AM
    I followed instructions in documents but I get this infinite loading screen. Please help.
    s
    n
    • 3
    • 9
  • How does supabase retrieve foreign table relationships?
    c

    Cheqo

    09/04/2022, 11:14 AM
    I am using supabase nextjs stripe payments project and I came across this line of code:
    Copy code
    const { data, error } = await supabase
        .from('products')
        .select('*, prices(*)')
        .eq('active', true)
        .eq('prices.active', true)
        .order('metadata->index')
        .order('unit_amount', { foreignTable: 'prices' });
    Everything works, but how does it connect products with matching rows in the prices table? Products table itself has no
    prices
    column. Prices table do have
    product_id
    column, but how does it know automatically what to connect since we only wrote
    .select('*, prices(*)')
    . I would have imagined that we had to write something like
    connect('prices').where('product_id).eq('id')
    , but it seems like it does this automatically?
    s
    s
    • 3
    • 3
  • Backup of snippets in SQL Editor
    d

    Denis_

    09/04/2022, 11:42 AM
    Hello, I am curious whether the snippets created using web UI are included in some backups or what is the best way to back them up, thanks! I have seen no mention of this in docs.
    s
    • 2
    • 2
  • What is wrong with my RPC function?
    j

    joshcowan25

    09/04/2022, 11:44 AM
    I'm trying to create a function that would get some rows from table1 and then loop over them to count the number of rows corresponding in table 2 and table 3. The goal is to create an object with the titles from table1, and the count of table 2 and 3, for each rows selected from table1 This is my query for now: declare nbExercices int; nbDone int; tLecons text[]; begin for row in select * from lecons where statut = true order by ordre asc loop select count(id) into nbExercices from exercices where lecons = row.id select count(id) into nbDone from progression where lecon = row.id array_append(tLecons, {fr: row.titre_fr, en: row.titre_en, nb: nbExercices, done: nbDone}) end loop return tLecons end I would expect to receive something like that: [{fr: 'Titre', en:'Title', nb: 12, done: 4}, {fr: 'Titre2', en:'Title2', nb: 18, done: 5}]
  • Module nuxtjssupabase is disabled due to incompatibility issues
    w

    weilzuvielgewalt

    09/04/2022, 11:59 AM
    WARN Module @nuxtjs/supabase is disabled due to incompatibility issues: 13:56:46 - [nuxt] Nuxt version
    ^3.0.0
    is required but currently using
    3.0.0-rc.8
    I'm getting this after npm run dev with Nuxt 3?
    s
    • 2
    • 5
  • Text search
    v

    VuNguyen

    09/04/2022, 12:13 PM
    How can I search a row that has value
    Xin chào
    with
    xin chao
    and
    xin chào
    keyword?
  • RPC or multiple request?
    j

    joshcowan25

    09/04/2022, 1:08 PM
    Is there any difference between doing a RPC function with 3 query or doing 3 supabase api call?
    n
    g
    • 3
    • 5
  • no unique constraint matching
    a

    andriusmv

    09/04/2022, 1:31 PM
    Hey guys. Trying to stablish a foreign key relationship between two tables (Plans.quantity < Subscription.quantity), but getting the > "Failed to update column "quantity": Failed to run sql query: there is no unique constraint matching given keys for referenced table "subscriptions" error message. Here is a snapshot of my db schema. I just want the quantity (or seats) of this tiny SaaS to be updated via the Stripe's Webhook.
    g
    • 2
    • 3
  • How to create a procedure function to add triggers for all tables.updated_at?
    a

    AlbertGao

    09/04/2022, 1:32 PM
    was writing one but failed...wonder if there is a snippet i can copy from, thanks 😄
    t
    • 2
    • 1
  • is the authed user being populated in edge function?
    a

    AlbertGao

    09/04/2022, 3:41 PM
    I mean, the one who sends the request, i want to get the user's information who sends the request to the edge function. i am able to do it by the following code:
    const session = await supabaseClient.auth.api.getUser(getTokenFromReq(req));
    works great! just wonder if it is the correct way, since i assume consider the user is authenticated, should not the info being fetched as well, so i do not need to waste another call? but if my assumption is wrong, then my current way should be totally fine. just need a confirmation, thanks 🙂
    g
    • 2
    • 1
  • how to do a transaction DB call?
    a

    AlbertGao

    09/04/2022, 4:02 PM
    for example, i have 3 inserts that want them to behave atomically, either successfully together or fail together, how to do that with supabase.js on the server side? thanks 🙂
    g
    • 2
    • 1
  • What are the differences between session.data and session.user from supabaseClient.auth.api.getUser?
    a

    AlbertGao

    09/04/2022, 4:08 PM
    they have the same signature,
    User|null
    when should i use which? thanks 🙂
    g
    • 2
    • 2
  • Table size and full text search performance
    l

    Lukas V

    09/04/2022, 4:37 PM
    Hello, I am using supabase and want to implement full text search. I want to store 2 different types of recipes: 1. Searchable recipes (recipes that are official, checked, correct values). 2. non searchable recipes (copies of other recipes, non verified or user generated) Should I have 2 different tables for these two groups or put everything into one table and have a column
    searchable
    ? Let's say if I only have 300 searchable recipes and 5 million non searchable, would that impact performance in any way?
    t
    • 2
    • 3
  • postgres_changes not triggering locally
    i

    InspectorT

    09/04/2022, 4:50 PM
    Hello! I'm following the docs here https://supabase.com/docs/guides/realtime/postgres-changes It works for me against hosted supabase, but the same setup is not working locally. I have the following code to set up the listener:
    Copy code
    typescript
            supabaseClient
              .channel('db-changes')
              .on(
                'postgres_changes',
                { event: 'INSERT', schema: 'public', table: 'parties' },
                (payload: unknown) => {
                  console.log('new party', payload);
                }
              )
              .subscribe();
    When I create a new row on this table in the UI on app.supabase.com, I see the event come in. When I update the client to point to the local instance, the same code does not trigger when I insert a new row in the local UI. I have verified the replication option is enabled for the
    parties
    table. Any suggestions on how to debug?
    g
    • 2
    • 21
  • Add additional UID Fields To Private User Table
    j

    jon.m

    09/04/2022, 7:27 PM
    Is there a way to add fields to the private user table like organization id and other relational keys?
    g
    • 2
    • 3
  • Keep getting `Auth event missing` when trying `supabase.auth.api.setAuthCookie(req, res)`
    t

    try_catch.js

    09/04/2022, 7:53 PM
    Here's the code I'm using with NextJS on
    pages/api/auth/setServerSideCookies.js
    `import { supabase } from '@/utils/supabaseClient' export default async function handler(req, res) { if (req.method !==
    POST
    ) { return res .status(500) .json({ message:
    This endpoint requires a POST request!
    , status: 400 }) } const { error } = await supabase.auth.api.setAuthCookie(req, res) console.log('IS ERROR ????: ', error) if (error) { return res .status(500) .json({ message: error.message, status: error.status }) } } ` I really don't know what I'm doing wrong
    j
    • 2
    • 10
  • Types for channel subscriptions
    i

    InspectorT

    09/04/2022, 9:30 PM
    Hi! What's the recommended best way for getting types in the callback for a channel subscription?
    Copy code
    typescript
      supabaseAdmin
        .channel('public:parties')
        .on(
          'postgres_changes',
          { event: 'INSERT', schema: 'public', table: 'parties' },
          (payload) => {
            console.log('new party', payload.record); // how to type this function?
          }
        )
        .subscribe();
    I am already passing in the generated
    Database
    definition when instantiating the supabase client
    Copy code
    typescript
    export const supabaseAdmin = createClient<Database>(
      environment.supabaseURL,
      environment.supabseServiceKey
    );
    • 1
    • 1
  • RLS and CORS
    d

    draco

    09/04/2022, 10:01 PM
    Potential noob question. I am trying to find out if I can check the origin of a call to my supabase instance within RLS. Basically, along with user authentication, I want to only accept calls from
    hhtps://www.example.com
    . Is this something that is possible? Otherwise if it is not possible, is it at all necessary? If I want to say ensure that only people signing up from a specific domain are able to do so, how would I make that happen using RLS?
    k
    g
    p
    • 4
    • 19
  • Current Postgres version
    d

    dreinon

    09/05/2022, 12:15 AM
    Hi! I have a prod and a dev supabase projects. The prod db is postgres v12 and the dev one is postgres v13. As far as I've researched, supabase currently uses postgres v14 for their new projects, am I right? I know that postgres v13 enables hooks and probably a few more features that aren't available with v12, but does v14 enable any more features? Also, is there an update tool to migrate postgres version of your project easily? Thanks!
    g
    • 2
    • 1
  • RLS applying to many to many relationship
    a

    aaron

    09/05/2022, 1:06 AM
    What I want: a user in Supabase to have read/write access to a specific club within a school. I also want that user to only be able to access students that belong to that club. What I have: a RLS rule that successfully only returns clubs I should have access to. But if I get the list of students I get all students. Supabase tables:
    Copy code
    student:
    first_name
    
    student_club:
    student_id,
    club_id
    
    club:
    name
    RLS for club table:
    Copy code
    (uid() IN ( SELECT profiles.user_id
       FROM profiles
      WHERE (profiles.club_id = club.id)))
    RLS is enabled for
    club
    with the above rule and disabled on the other tables. Do I need to add similar rules to the students and student_club tables? I was hoping I'd write essentially one rule and it would cover all the cases to reduce chances of bugs
    j
    • 2
    • 5
  • Create user profiles from OAuth data
    n

    nukeexplosions

    09/05/2022, 1:18 AM
    I need to create a table with user profiles that stores a twitch ID for every signup. How would I go about doing this? I only allow users to signup with twitch.
    u
    h
    • 3
    • 2
  • cant connect to db server
    d

    drilkmops

    09/05/2022, 1:19 AM
    It's been a few months since I have touched my app, but decided to mess around again. I'm met with a "Can't reach database server at `db.**.supabase.co`:`port`" I was able to connect to that supabase schema app using my url / api key. But using the secret key doesn't seem to work. Any ideas?
    g
    • 2
    • 7
  • Multiple SSO identities for a single user
    j

    jaitaiwan

    09/05/2022, 3:39 AM
    Hi I'm wondering what steps one would have to take to attach new sso identities to an existing user. For example assume a user signed up via discord, and wants to associate their google login with their account also. How could that be done?
    t
    h
    g
    • 4
    • 5
  • Problem reseting password, getting wrong URL
    a

    AdrianMsM91 {KBL}

    09/05/2022, 7:38 AM
    Good morning, When I'm trying to reset my password in my webpage https://kabila.app pressing in Forgot you password? , the URL which I'm receiving is not the URL I'm specifying... in my LocalHost is arriving correctly, but once I deploy, It doesn't work anymore. I'm receiving the email correctly, as you can see in the second image attach, but the URL is not the good one, right now I'm receiving this URL: https://rptsepcgngjhknqvnogm.supabase.co/auth/v1/verify?token=406b8d5c4175012f229117711724560bef3f99223c1a19b4d6ad5875&type=recovery&redirect_to=https://kabila.app/ and as you can see, in my code I have this one, which is the same than I'm receiving in my LocalHost
    Copy code
    js
    const resetPasswordForEmail = async (email) => {
        return await supabase.auth.api.resetPasswordForEmail(email, {
          redirectTo: `${APP_HOST}/authentication/recovery-password`
        });
      };
    Also as you can see in the settings of Supabase is everything good also, attach in the images. Any idea how can I fix it? Thanks
    p
    • 2
    • 6
  • getSession returns null on the server
    s

    Satou kuzuma

    09/05/2022, 7:38 AM
    I’m using the latest version of supabase on next js. After login I use router.push to redirect to the index page and you then I get session null. Do I need to set an api route for this to work? Do I still need to wrap the app with the nextjs auth helpers like when using getUseByCookie? There’s no much documentation with the new implementation so I’m not sure if I’m doing something wrong. Thanks in advance !
  • auth-ui-react loading animation
    c

    chaos

    09/05/2022, 8:54 AM
    I am using "auth-ui-react" https://supabase.com/docs/guides/auth/auth-helpers/auth-ui But after clicking on the sign up button, there is no loading animation, how can I add it?
  • some table is missing with gen types
    t

    tangle

    09/05/2022, 9:04 AM
    I ran the command below to generate types in a local database. supabase gen types typescript --local but one table (which is named as dress) is not generated. Data in this table was manually copied by running sql file via psql (psql -h localhost -p 54322 -U postgres -f dump_dress_20220831.sql) dump_dress_20220831.sql is like this COPY "public"."dress" ("name", "name_kor", "id", "color", "price", "dress_info") FROM stdin; \N 도트도트 72 \N \N \N ANDY 앤디(55) 1 \N \N \N BLACK OFF 블랙오프(66) 8 \N \N \N ANDY 앤디(66) 2 \N \N \N ... Is the fact that I copied data manually something to do with it? What should I do to include this table in the result of generating type command?
1...151617...230Latest