https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How do you query your Supabase table?
    a

    AntDX316

    01/17/2023, 8:35 AM
    How do you query your Supabase table with GET and how do you do the other stuff like create, update, delete from outside the website?
    f
    g
    • 3
    • 6
  • Database design help
    m

    miky2fois

    01/17/2023, 9:12 AM
    How would you design your database with the following use case? 1) User can add recipes to their favorites (like a recipe basically) 2) User can get all their favorite recipes (from the user id) 3) From a recipe view I’m able to know if the recipe is in the user favorites. I don’t know what’s the best way to design such a relationship, any help is appreciated.
    j
    f
    • 3
    • 4
  • Auth Phone OTP - Permanent code for a specific phone number
    f

    fridon

    01/17/2023, 9:23 AM
    Is it possible to define a test user that has a static otp? Needed for Google Play Console app access review
  • Supabase.Gotrue.RequestException: {"code":429,"msg":"Rate limit exceeded"} way to disable?
    l

    leonardi

    01/17/2023, 10:04 AM
    Our app uses Supabase Auth and we are running an event at a physical venue where we expect all participants to log in to our app from the same IP (venue) during testing we are running into this rate limit issues, is there any way to disable or at least configure the rate limit so that it's higher?
    g
    • 2
    • 3
  • Deploy realtime server to listen to changes
    e

    ekko

    01/17/2023, 11:33 AM
    Hey, I'm wanting to deploy a server which listens DELETE events on a table, which inserts them into another table for archive. I've tried deploying this as an edge function. It works locally, but doesn't seem to work in production. My question is - where is the easiest/simplest platform I can host this app, preferably for free or cheap? Thank you
    • 1
    • 1
  • Auth Error While SignInWithOauth
    a

    Abdul ♥

    01/17/2023, 12:04 PM
    Copy code
    {
      "code": 400,
      "msg": "OAuth state parameter missing"
    }
    o
    p
    • 3
    • 6
  • Either 0 per month or 25?
    m

    Mofoga

    01/17/2023, 2:57 PM
    Hei there Is it not possible to only add some more computational power to the project instance? I would only need some additional RAM. I dont need all the pro features. But I only see going pro not only the addons
    g
    • 2
    • 2
  • Why am I getting 'new row violates row-level security policy for table "profiles" '
    j

    Johnny

    01/17/2023, 3:10 PM
    Hey, I keep getting the status
    Copy code
    ts
    status:  {
      code: '42501',
      details: null,
      hint: null,
      message: 'new row violates row-level security policy for table "profiles"'
    }
    with the code:
    Copy code
    ts
    const body = Object.fromEntries(await request.formData())
    
            /**
             * Passwords must match
             */
            if(body.password !== body.confirmPassword) {
                return fail(400, {
                    error: "Passwords do not match",
                })
            }
    
            /**
             * Password must be at least 8 characters and max 32 characters
             * 
             */
            if(body.password.length < 8 || body.password.length > 32) {
                return fail(400, {
                    error: "Password must be at least 8 characters and max 32 characters",
                })
            }
    
            /**
             * First name and Last name check
             */
            if(body.firstName === "" || body.lastName === "") {
                return fail(400, {
                    error: "First and last name are required",
                })
            }
    
    
            const { data, error: err } = await locals.sb.auth.signUp({
                email: body.email as string,
                password: body.password as string,
            })
            if(data?.user == null){
                return fail(400, {
                    error: "User creation failed",
                })
            }
            await createProfile(data?.user,body);
    
            async function createProfile(data: User, body: any){
                console.log(data.id)
                let f = "Bob"
                let l = "Smith"
                const { error, status } = await locals.sb
                .from('profiles').insert([{ id: data.id, full_name: (f + " " + l)}])
                console.log("status: ", error)
    
            }
    But the row is being created (no full_name is being set -> null) anyone an idea why?
    g
    • 2
    • 23
  • Does Supabase have plans to support custom domains for serverless functions?
    c

    corey

    01/17/2023, 5:34 PM
    This would be fantastic. Thanks!
    a
    • 2
    • 5
  • "unexpected field description type on __Schema" using graphiql to get schema.
    r

    ryanT

    01/17/2023, 6:38 PM
    Following the supabase-graphql-example (https://github.com/supabase-community/supabase-graphql-example/blob/main/app/pages/api/graphiql.ts) I cannot get graphiql to pull the schema from supabase correctly. I get the following error (see attached picture) when loading up the /api route:. If I try to overwrite the body with a
    getIntrospectionQuery({description: false})
    it is not respected and description is still requested. Any thoughts on how to get past this?
    • 1
    • 1
  • SQL Used to Generate Tables
    b

    BoogersLLC

    01/17/2023, 7:14 PM
    Is there a way to see the SQL used to generate tables created through the Table Editor (https://app.supabase.com/) ? For example, if I make a table with some columns and constraints (in the table editor), I'm assuming that translates to a SQL statement that runs under the hood. Is there a way to see/edit that SQL? Basically, I want to generate tables via SQL instead of using the UI/Table-editor, but I'd like to see some examples so I'm following the conventions it's expecting.
    g
    • 2
    • 2
  • Return after insert blocked by RLS
    m

    monks1975

    01/17/2023, 8:49 PM
    I have an after insert trigger that adds a row to a table as a user permission for that resource. The permission is used in a RLS policy for reading resources from that table. When I insert a new resource using the supabase client with a chained select() to get the return data, I get a policy error, because at that point the read permission hasn't been created. I need the id from the insert to use later in my edge function. Any ideas how I could solve this? If I try to set the permission before the insert I violate a foreign key constraint.
    g
    • 2
    • 3
  • Port suddenly changed from 5432 to 6543 but connection strings still point to 5432
    s

    Sinistral

    01/17/2023, 9:52 PM
    Hello! I'm going through and messing with a nextjs project using Prisma and Supabase. I'm wrapping my head around prisma migrations when suddenly it seems like the port I need to use to CLI into my supabase went from 5432 to 6543, but this prevents my migrations from working as I don't think I am supposed to use connection pooling (which defaults to 6543 I think?). I'm just really confused on why this suddenly changed, because I didn't change it and it was working just fine a moment ago.
    • 1
    • 2
  • FTS foreign table columns?
    d

    DYELbrah

    01/17/2023, 11:01 PM
    Hey everyone I'm curious on your implementations of FTS if you need to also include foreign columns on your search? I have two tables: Customer and Customer_Transaction they're joined via customer_transaction.customer_id = customer.id Lets say that I need to implement FTS that searches all columns of customer_transaction + the first and last name of the customer which is ONLY stored in the customer table. How would you guys implement this? I'm wondering if you guys are somehow creating a single search column with a GIN index? How could I implement that if I have to search two tables. Typically you can create an index with multiple columns from 1 table, not sure if it's possible for another? Any opinions or thoughts? Thanks!!
    g
    • 2
    • 8
  • Full-text search on Views
    j

    jinsley8

    01/17/2023, 11:31 PM
    Does anyone know if full-text search indexes can be used on views instead of tables? https://supabase.com/docs/guides/database/full-text-search#creating-indexes
    g
    • 2
    • 1
  • Query or View to get products for brand?
    j

    jinsley8

    01/17/2023, 11:46 PM
    I'm newer to SQL so this question may be simple but say I have 100,000 products and each has a brand. Say there are 400 brands. If I want to show a brand's own products on a brand page... is it best to just query all products where brand === X or is there a way to setup a dynamic View where the WHERE is whatever brand you're on? Is there a more performant way to query brand from 100,000 rows then the basic SELECT? Or setup an index so it's faster?
    Copy code
    sql
    SELECT brand
    FROM products
    WHERE brand = "ABC"
    n
    s
    • 3
    • 6
  • Add phone to email registered users
    u

    usamichizuru

    01/18/2023, 1:39 AM
    So I have users sign up and log in by email. After doing the email confirmation things, I also want to add their phone number to auth. However, I can only register more people in step of update the authenticated user with phone. So can we have people with phone and email at the same time? If so, can how can we do it and update the others?
  • Foreign key relation for arrays?
    e

    Elliott Storey

    01/18/2023, 1:57 AM
    I want to make sure that each member of users.roles[] exists in roles.role. It seems to me that what I want is a foreign key constraint on each member of users.roles[] such that if references roles.role. This doesn't seem possible with postgres. Am I looking at this the wrong way? What is the suggested "right" way to handle this?
    g
    s
    • 3
    • 8
  • Subscribe to changes using contains filter
    b

    bob_the_robot

    01/18/2023, 2:40 AM
    I have a select that works fine, but I need a similar select for subscriptions.
    Copy code
    js
    return supabase
      .from("games")
      .select("*")
      .eq("is_active", true)
      .contains("players", [user.id])
      .then(...)
    Not sure how to replicate the
    contains
    portion in the below query, any guidance is great!
    Copy code
    js
    return supabase
      .channel("game-channel")
      .on(
        "postgres_changes",
        {
          event: "*",
          schema: "public",
          table: "games",
          filter: `is_active=eq.true`,
        },
        (payload) => {
          console.log("Change received!", payload);
        }
      )
      .subscribe();
    I read through https://supabase.com/docs/reference/javascript/subscribe but there doesn't seem to be any examples of multiple filters being used. T.Hanks!
    g
    • 2
    • 6
  • Filtering data on a join
    v

    Vik

    01/18/2023, 2:41 AM
    Hi, I'm currently requesting all a users friends from a query. RLS only allows selecting where
    user_one
    or
    user_two
    are equal to the logged in user. But, right now when I request this data my own profile is also returned multiple times. How can I add a filter to this where I only get all other profiles but my own for each friendship?
    Copy code
    export const getFriendships = async () => {
      const { data, error } = await supabaseClient
        .from('friendships')
        .select('*, user_one(*), user_two(*)');
    
      if (error) {
        throw Error(error.message);
      }
    
      return data;
    };
    b
    g
    • 3
    • 14
  • Using signinwithgoogle(), who can i redirect it to the current page?
    d

    darick

    01/18/2023, 7:02 AM
    Hello, im developing a site using signinwithgoogle, in this case, in many pages, if users want to click a btn, they have to signin first. In current situation, they always went to HOME after signinwithgoogle(). How can i make them stay the same page where they click the btn after signin?
    s
    • 2
    • 2
  • "message": "No API key found in request"
    r

    RickRyan26

    01/18/2023, 7:31 AM
    When redirecting back to my website after auth I'm ending of at a page that shows only the below code. Any ideas on what I set up wrong? Thank you!
    Copy code
    {
      "message": "No API key found in request",
      "hint": "No `apikey` request header or url param was found."
    }
    s
    • 2
    • 8
  • SQL Injection in RPC?
    s

    STILLWATER;

    01/18/2023, 8:21 AM
    I was wondering Im using RPC functions in supabasejs in most of my code which takes variables and put it in RPC functions in places like
    WHERE name LIKE $1
    or
    age=$1
    etc, is this code sql injectable??
    s
    • 2
    • 2
  • pgRouting extension - usage documentation?
    r

    rbsam

    01/18/2023, 9:44 AM
    I'm looking to set up pgRouting but doing it from scratch seemed too complex for my current level, I saw that Supabase has it already built as an extension but there's no documentation no how to use it. I can't seem to identify which parts of the official documentation would be relevant as it's all geared towards users who are setting it up themselves, rather than Supabase handling a lot of it. Can anyone provide a summary on how to use it?
    g
    • 2
    • 1
  • Inserting an array to a table
    m

    MaGnezij

    01/18/2023, 9:46 AM
    Hi, im trying to run this sql command: INSERT INTO "Recipes" ("tags") VALUES ('["A","B"]'), but im getting this error: Failed to run sql query: malformed array literal. Any ideas how can I insert an array?
    g
    • 2
    • 1
  • Multiple password recovery endpoints and email templates???
    s

    Serj Hunt

    01/18/2023, 10:34 AM
    Hi guys. we have multiple user types on our app We need to differnt types of users to differnt passowrd reocvery pages. Can we create multiple password recovery endpoints and email templates in supabase?
  • Getting 404 error when trying to do a DELETE through postman.
    a

    AntDX316

    01/18/2023, 11:25 AM
    Help please. The GET works fine with 200 OK and POST with 201.
    g
    n
    • 3
    • 65
  • How can I migrate from a development database that I have online to a production database?
    f

    Fainaru

    01/18/2023, 11:52 AM
    How can I migrate from a development database that I have online to a production database that is also online?
    g
    • 2
    • 4
  • Get user ID on Signup
    h

    HugoDuprez

    01/18/2023, 12:46 PM
    Hi folks! Is it possible to get the user ID just after signUp()? I want to settle an external db the moment the user is created 🤔 Cheers!
    g
    • 2
    • 2
  • RLS for any in uuid[]
    b

    bob_the_robot

    01/18/2023, 2:51 PM
    I haven't written SQL in over 10 years, so sorry that this is probably a pretty basic question. I am setting up RLS on a table named "game" that has a column of "players" set to
    uuid[]
    that correspond to each player's "profile". Any "player" in a "game" can UPDATE the row with the latest game state. I have RLS setup as
    Copy code
    sql
    (uid() = ANY (players))
    for both of the required boolean expressions, but whenever a user tries to update the row I get
    Error: new row violates row-level security policy for table "games"
    Maybe there is a better way to do this?
    g
    • 2
    • 24
1...100101102...230Latest