https://supabase.com/ logo
Join Discord
Powered by
# help
  • f

    Finn

    04/18/2022, 12:06 PM
    hello! i'm a bit confused about RLS. because the users table is schema of public, can anyone see all other user accounts?
    n
    g
    • 3
    • 16
  • f

    Finn

    04/18/2022, 12:30 PM
    is there rate limiting on supabase's side for things like login so brute force isn't an issue?
    n
    • 2
    • 1
  • e

    evanw

    04/18/2022, 1:01 PM
    Hi all, just picked up Supabase for a project and I have a noob question ––  I have a table
    conversations
    with column
    participants
    of type JSONB (originally JSON but I think it needs to be JSONB) where the structure is something like:
    Copy code
    [
      "Emily",
      "Renee",
      "Martina"
    ]
    I'm trying to return an array of all
    conversations
    where
    participants
    includes the current user, e.g. "Emily". This is what I've tried, but I'm certain this is wrong:
    Copy code
    let { data, error, status } = await supabase
        .from('conversations')
        .select('id, name, participants')
        .contains('participants', ['Emily']);
    Any pointers? Or should my data be structured differently? (Future state,
    participants
    might be more like
    [ { name: 'Emily', id: 123 } ]
    but for right now I'm just trying to sorta learn the basics The error I'm getting with this is "invalid input syntax for type json"
    n
    g
    • 3
    • 5
  • n

    NinjaNuur

    04/18/2022, 1:11 PM
    Hey, I've created an on_auth_user_created trigger using sql (not from the UI) When I create a new auth user, the trigger runs and I get "Database error updating user" TRIGGER
    Copy code
    drop trigger if exists on_auth_user_created on auth.users;
    create trigger on_auth_user_created
        after insert
        on auth.users
        for each row
    execute procedure public.handle_new_user();
    Function
    Copy code
    create or replace function public.handle_new_user()
        returns trigger
        language plpgsql
        security definer set search_path = public
    as
    $$
    begin
        if new.phone is null then
            insert into public.company_user (id, email, first_name, last_name)
            values (new.id, new.email, new.raw_user_meta_data ->> 'first_name', new.raw_user_meta_data ->> 'last_name');
            return new;
        else
            insert into public.personal_user (id, phone)
            values (new.id, new.phone);
            return new;
        end if;
    end;
    $$;
    Any help would be appreciated
    n
    g
    • 3
    • 16
  • s

    Simey

    04/18/2022, 1:18 PM
    Hi I need help with row level security. I am struggling to get it working. I have a table called
    lists
    with a
    user_id
    column. I keep trying to add a rule for
    auth.uid() = user_id
    , it adds successfully. However, it doesn't work. The first thing that looks funny is that on the policies view it shows as "ALL Users can only see their own lists `(uid() = user_id)`" with
    uid()
    on its own instead of
    auth.uid()
    . Furthermore when I then try to access rows it returns nothing.
    n
    g
    • 3
    • 24
  • s

    Simey

    04/18/2022, 1:21 PM
    So my 2 questions are: 1) Please help me get this working and 2) how do I debug a RLS Policy if it isn't working?
    n
    • 2
    • 1
  • f

    feLiruc

    04/18/2022, 1:57 PM
    Hello guys. I'm installing the supabase in a VPS I already have for a long time, and I'm using apache2 to host it. But I didn't found any .conf file example for supabase with the apache2 web server, just nginx. Don't know if I have to migrate my server to nginx (that probably will cost me a lot of time to make all my websites work on it) or you have some example for me...
    n
    o
    • 3
    • 6
  • n

    nicedaynot

    04/18/2022, 7:49 PM
    Hey guys! I just wondered if it's possible to have a trigger so that when a file is uploaded to the storage, it gets information of that file (the filename, the url, the file type) and store it within a table in the database?
    n
    g
    • 3
    • 3
  • m

    meera_datey

    04/19/2022, 1:45 AM
    When user has previously signed-in. and tries to signs in again. There is no error reported. Just success! How do we handle this scenario? I see this, but no recovery email is sent. https://github.com/supabase/supabase-js/issues/296#issuecomment-976200828
    n
    s
    • 3
    • 4
  • a

    achilles

    04/19/2022, 2:40 AM
    Hi all, I have an issue with my email address. The supabase UI reflects an older email address that I no longer have access to. I have revoked supabase permission from GitHub account and then authenticated again, but it's still my old email in the supabase UI. I attempted to open a support ticket but then this happened: I'm kind of stuck at this point, not sure what to do.
    n
    g
    • 3
    • 4
  • s

    Steve

    04/19/2022, 3:21 AM
    Is there a way to access storage file in the table editor so I don't have to copy and paste thier paths to a
    text
    row in the db?
    n
    g
    • 3
    • 5
  • j

    JonWasTaken

    04/19/2022, 3:55 AM
    I've used the same syntax I've found from 5 different places, so I'm not sure why this would be happening, but running the following SQL results in
    db error: ERROR: malformed array literal: ""
    Here's the SQL, anyone know why it would be causing this error?
    Copy code
    ALTER TABLE props ADD COLUMN textSearch tsvector GENERATED ALWAYS AS (
      setweight(to_tsvector('english', coalesce(name, "")), "A") ||
      setweight(to_tsvector('english', coalesce(terms,"")), "B")
    ) STORED;
    
    CREATE INDEX props_textsearch_idx ON props USING GIN (textSearch);
    n
    g
    • 3
    • 9
  • n

    Needle

    04/19/2022, 4:07 AM
    Hello @FluffySmiles! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
    /title
    command! We have solved your problem? Click the button below to archive it.
    • 1
    • 2
  • t

    Tim Nirmal

    04/19/2022, 4:51 AM
    My SERVER API keys are changing (Sometimes twice for a day). Any one have idea why is that Because of that I have daily change .env file of the project
    n
    • 2
    • 1
  • j

    joshcowan25

    04/19/2022, 5:13 AM
    Is it possible to have an array of foreign key in a table? (so I would use from to get datas from foreign tables for each element of the array)
    n
    o
    • 3
    • 3
  • j

    joshcowan25

    04/19/2022, 5:15 AM
    Other question, is it bad practice to use JSON/JSONB for column? Like, is it better to have empty columns or to have a JSON document in your DB?
    n
    o
    • 3
    • 3
  • e

    emjay

    04/19/2022, 7:45 AM
    Promise unresolved for this call, any help appreciated: https://gist.github.com/mustefa/9b0d460dcc6602517dde3a68d31a1c9a
    n
    g
    • 3
    • 7
  • l

    Ludvig

    04/19/2022, 7:54 AM
    Is Supabase CLI not available via npm (node package manager)? https://github.com/supabase/cli
    n
    o
    • 3
    • 25
  • e

    enti

    04/19/2022, 10:04 AM
    I got a
    questions
    table with just a row of different questions. Each question can have different answers. Those are in a table
    answers
    , containing a foreign key
    question_id
    . I use an API call to get the structure I want :
    Copy code
    js
    let { data: questions, error } = await supabase
      .from('questions')
      .select(`
        question,
        answers(
          answer
        )
      `)
    Copy code
    json
    [
      {
        "question": "question one",
        "answers": [
          {
            "answer": "answer one for question one"
          },
          {
            "answer": "answer two for question one"
          }
        ]
      },
      {
        "question": "question two",
        "answers": [
          {
            "answer": "answer one for question two"
          },
          {
            "answer": "answer two for question two"
          }
        ]
      }
    ]
    But, for security reasons, I want to get the same result using a function and a RPC call. Unfortunately, I can't figure it out on my own. Is there a way to do it ?
    n
    • 2
    • 3
  • n

    Needle

    04/19/2022, 10:12 AM
    Hello @Evaldas_B! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
    /title
    command! We have solved your problem? Click the button below to archive it.
  • e

    Evaldas_B

    04/19/2022, 10:17 AM
    As far as I understand the feature where a magic link is sent if there was an attempt to register an already existing user has not been implemented yet. Here is the open issue https://github.com/supabase/gotrue/issues/286
    n
    m
    • 3
    • 4
  • b

    batuhanbilginn

    04/19/2022, 10:33 AM
    Hey guys, can we use Presence feature with Supabase Realtime Client anymore? Is there any documentation for this topic? I couldn't find anything yet.
    n
    • 2
    • 1
  • n

    Needle

    04/19/2022, 2:07 PM
    Hello @leviwhalen! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
    /title
    command! We have solved your problem? Click the button below to archive it.
    l
    • 2
    • 3
  • p

    pckimlong

    04/19/2022, 3:19 PM
    Hello Is it possible to use phone sign in with supabase local development, I cannot find setting option inside studio
    n
    • 2
    • 1
  • i

    Infrapuna

    04/19/2022, 3:44 PM
    Any suggestions on cron job/other schedulded execution service? I need to periodically (about once a day) perform a simple http call and update a supabase table with the info. I know you can use postgresql for it via an extension but seems a bit shacky.
    n
    s
    • 3
    • 3
  • x

    xenocythe

    04/19/2022, 5:00 PM
    Is anyone else getting stuck setting up new projects? It's been hanging for a while for me on two different attempts
    n
    b
    s
    • 4
    • 6
  • u

    ummahusla

    04/19/2022, 8:17 PM
    Hello there, I've recently started tinkering around supabase. So I went through a couple of video courses, and got stuck at the place where I need to create supabase function hook - https://egghead.io/lessons/supabase-automatically-create-a-stripe-customer-for-each-user-with-supabase-function-hooks. I've previously done the similar hook and it worked like a charm. I'm using
    ngrok
    and
    localtunnel
    while doing local development. Any ideas on how to debug it? I've tried to google, but haven't found the proper answer https://app.supabase.io/project/.../database/api-logs?te=&ts=
    n
    • 2
    • 3
  • e

    eoin

    04/19/2022, 8:40 PM
    Hi folks! 👋 I have an RLS policy set up so that only users whose
    user.uid
    is in a
    players
    array can access a
    /game/game.uuid
    route. It's working, but the "blocked" route is firing a
    304
    request to
    /api/game/null
    (guessing once RLS is hit) and then throwing
    code:22P02, message; invalid input syntax for type uuid: \\\"null\\\"
    . It then tries to render the component with no data and fails. Ideal state is that I can handle this more gracefully, add that the
    user.uid
    doesn't have access to this particular route to state and render an input field for them to enter a code which—if correct—would add their
    user.uid
    to the original
    players
    array, therefore meeting the criteria of the policy and providing access. Does anyone know how to better handle this redirect to
    /api/game/null
    and use it to control state rather than crash out?
    n
    s
    • 3
    • 16
  • p

    Prodigy7kX

    04/19/2022, 9:05 PM
    Hey all, I have this pretty simple query:
    Copy code
    ts
    async function deleteOneAccount(id: string) {
      const { data: account, error } = await supabase
        .from<Account>('accounts')
        .delete()
        .match({ id })
        .throwOnError();
    
      return { account, error };
    }
    The query is executed just fine but always throws back a warning:
    Copy code
    json
    {
      "details": "Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row",
      "message": "JSON object requested, multiple (or no) rows returned",
    }
    Can anyone explain why it does happen?
    n
    m
    g
    • 4
    • 6
  • h

    huga

    04/19/2022, 9:12 PM
    Hi guys!, Anyone know if its possible doing something like this? I need to find any word in various columns
    n
    g
    • 3
    • 4
1...260261262...316Latest