https://supabase.com/ logo
Join Discord
Powered by
# javascript
  • j

    jon

    11/01/2021, 5:16 PM
    What I want is to say, get me all records that are named new zealand OR france AND contain a certain keyword
  • j

    jon

    11/01/2021, 5:18 PM
    Also, can I include multiple AND statements in an OR?
  • m

    Mike92988

    11/01/2021, 11:15 PM
    anybody have any recommendations for how to run a webhook when a certain row is changed in the database?
  • l

    larryM

    11/03/2021, 3:24 PM
    when using upsert on a supabase row, can onConflict take an array of values, in case you have multiple columns conflicting?
    s
    • 2
    • 1
  • s

    Steve

    11/03/2021, 4:26 PM
    onConflict array
  • t

    the.watcher

    11/04/2021, 6:59 AM
    anyone here having trouble with CORS? I just created NextJS project (using v12) and using supabase.auth.signIn would throw CORS error
  • t

    the.watcher

    11/04/2021, 9:16 AM
    recently move to another supabase instance, and it works immediately. seems like there's a bug on a restarted instance
    s
    • 2
    • 1
  • s

    silentworks

    11/04/2021, 10:12 AM
    CORS error with instance
  • k

    kresimirgalic

    11/04/2021, 8:23 PM
    Hey all, I can't find anywhere how to sort data by date, for example i want to sort upcoming events, or get past events... Does anyone have that resolved or know the solution?
  • h

    hoesmean

    11/04/2021, 9:02 PM
    #869406062036529193 Hello everyone, i want display data with flat list or map function but i can't display related array data, how can i make? Thank you
  • p

    Pragy

    11/05/2021, 9:55 AM
    what's the correct way to setup SvelteKit with Supabase? The auth works flawlessly on the client side, but how do I get the session details on the server end? There's several examples on github, but all of them themselves claim to be a bit "hacky" and perhaps not the correct way of doing things.
    s
    • 2
    • 12
  • s

    silentworks

    11/05/2021, 10:29 AM
    SvelteKit and Supabase
  • u

    unix17

    11/06/2021, 10:27 AM
    Hello guys, have some problems, I use real-time on my project, and all tables listening fine except one table , maybe someone has the similar issue. on().subscribe()
  • x

    Xzeta

    11/06/2021, 1:24 PM
    is this how you would get user profile after the user logins or session ?
    Copy code
    useEffect(() => {
        setSession(supabase.auth.session());
        if (supabase.auth.session()){
          getProfile();
          //setProfile
        }
        supabase.auth.onAuthStateChange((_event, session) => {
          setSession(session);
        });
      }, []);
  • e

    egnus

    11/06/2021, 7:11 PM
    Hello team, I have 2 doubts of using the supabase lib. First. I have 3 tables to handle roles that can interact with tables based on the user relationship with the project, 4 tables:
    users
    ,
    projects
    ,
    roles
    and
    projectMembers
    with Primary keys
    user_id, project_id
    and a single
    role_id
    per user/project (not primary). I want to know if a given user is capable of reading a random table if we know the project owner of the table and the user itself. So i use this:
    Copy code
    javascript
    const { data, error } = await supabase
        .from("users")
        .select("name, projects(name, role:roles(name))")
        .eq("id", 1) // id of the user
        .eq("projects.id", 2) // id of the project
        .single();
    The problem is that, even if i fix the FK of the project to 2 I still get an array for projects, and even if only one role can be assigned, I also get and array of objects. Is it there any way i can make foreign tables to be single if I know they should be only one??? This is what I get for example from the previous project:
    Copy code
    json
    {
      name: 'John',
      projects: [
        { name: 'ACME', role: [ { name: 'project_admin' } ] }
      ]
    }
    Also, another weird thing with the API, If i filter a foreign key and nothing is found, I still get all the table with
    []
    in the foreign key. How can I remove entries that are empty or not found in foreign tables from the main table. Example:
    Copy code
    javascript
    const { data, error } = await supabase
        .from("users")
        .select("name, projects(name)")
        .eq("projects.id", 9999) // nobody is asigned to this project.
    instead of getting
    []
    I get all the users but with empty foreign key like this:
    Copy code
    json
    [
     {
       name: 'John',
       projects: []
     },
     {
       name: 'Mike',
       projects: []
     },
     // and all the entire list of users. When nothing should actually be returned.
    ]
    I don't undertand but I think this issues are unavoidable in the Javascript library, aren't they?
    s
    • 2
    • 4
  • v

    Vinzent

    11/06/2021, 7:13 PM
    Did you enable realtime /replication for that table?
  • s

    Steve

    11/06/2021, 9:48 PM
    doubts
  • u

    unix17

    11/06/2021, 10:59 PM
    Thanks, good point
  • l

    larryM

    11/07/2021, 1:00 AM
    is it possible to use a foreign key within a listener? so whenever a new object inserted the related data is also send in the payload.new
  • g

    garyaustin

    11/07/2021, 1:08 AM
    Realtime uses the replication feature of Postgres for the exact table you want a listener on. Because at the moment, realtime/replication ignores RLS you are probably better off just getting "an update occurred at" from the payload and then fetching the data with a new request that honors RLS, IMO unless it is totally public data.
  • l

    larryM

    11/07/2021, 1:09 AM
    thanks thats what i figured. currently the data is somewhat public (user info) but not something we'd want public access to.
  • f

    Ferran

    11/07/2021, 7:00 AM
    Hey guys, I'm implementing third party authentication in react. After following the documentation, I'm presented with a null user object and a null session object. After a little bit of digging, I understand that this is the intended behaviour, but how would I go about authenticating my user without a user object? Any help is highly appreciated.
    s
    d
    • 3
    • 2
  • s

    Scott P

    11/07/2021, 5:17 PM
    React auth
  • m

    magicbyt3

    11/07/2021, 7:52 PM
    Hey all, I am wondering if there's a way to automatically reference the creating users uuid / auth.uid on insert in a table without having to send it from the client?
  • g

    garyaustin

    11/07/2021, 8:15 PM
    If you mean you want to insert the uid in a column then you should be able to set default to auth.uid() for that column.
  • m

    magicbyt3

    11/07/2021, 8:20 PM
    yeah that works, thanks a bunch!
  • m

    Mike92988

    11/08/2021, 8:28 AM
    Is there a way to set up a webhook to run whenever a value from a specific column is updated?
  • e

    egnus

    11/08/2021, 8:46 AM
    I think it is possible via triggers and http extension, didn't investigate much just yet
  • y

    yourfriend

    11/08/2021, 6:32 PM
    i think i found a weird bug for the js client
  • y

    yourfriend

    11/08/2021, 6:37 PM
    well, that was fun to figure out
1...293031...81Latest