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

    Darkwebplayer

    09/05/2021, 6:14 PM
    hey, can someone point to me an example or reference of supabase storage api of uploading multiple files to the storage. I can upload single file but i want to upload multiple files. i can do this directly in supabase admin ui way, so i hope there is a way to do this with the api too..
  • s

    stibbs

    09/06/2021, 1:50 AM
    I have a form which on submission should create records in 3 tables, and in a specific sequence. Should this be done in my JS code, or should I be learning how to do stored procedures..? Or something else?
  • l

    lawrencecchen

    09/06/2021, 3:54 AM
    if it's just inserting rows, you can just insert from the client (frontend js)
  • l

    lawrencecchen

    09/06/2021, 4:09 AM
    supabase admin uploads each file separately. I would just loop through the files on the frontend and upload each one separately (though this is iffy if it fails halfway and can't guarantee a transaction)
  • d

    Darkwebplayer

    09/06/2021, 4:14 AM
    Oh, anyways thanks, i was just looking for a way to do this without the loop since the problem you mentioned exists..πŸ‘
  • s

    stibbs

    09/06/2021, 7:54 AM
    So it's fine to do ~3x connections per form submission?
  • s

    stibbs

    09/06/2021, 9:18 AM
    Insertions 2 and 3 need to happen together actually
  • j

    jason-lynx

    09/06/2021, 9:30 AM
    then triggers or stored procedures would be better for your use case
  • j

    jason-lynx

    09/06/2021, 9:30 AM
    an insert 1 triggers inserts 2 and 3
  • s

    stibbs

    09/06/2021, 9:39 AM
    cheers, another thing to learn 🀣
  • j

    jason-lynx

    09/06/2021, 9:44 AM
    haha it's just like the
    handle_new_user()
    trigger function that's recommended, if you created a
    public.users
    table
  • j

    jason-lynx

    09/06/2021, 9:46 AM
    https://github.com/supabase/supabase/discussions/306#discussioncomment-138424
  • s

    stibbs

    09/06/2021, 9:47 AM
    Thanks!
  • s

    SETY

    09/06/2021, 10:11 PM
    Copy code
    let { data, error } = await supabase.from("user_roles").select(`
                id, role,
                auth.users (
                    email
                )
            `);
  • s

    SETY

    09/06/2021, 10:12 PM
    am I unable to select from the auth schema? user_roles has a reference to auth.users
  • s

    SETY

    09/06/2021, 10:13 PM
    getting an error when I am trying to do this
  • d

    davitykale

    09/07/2021, 12:00 AM
    Has anyone been able to get auth with a magic link working with Expo/React Native?
  • s

    Scott P

    09/07/2021, 12:09 AM
    Something like this should work: https://discord.com/channels/839993398554656828/869406062036529193/880535146086936617
  • j

    jordan801

    09/07/2021, 2:23 AM
    Does anyone know why I am getting an array under the error property, if the WHERE clause has no match, in response to an UPDATE query via the supabasejs client? i.e.
    supabase.from('some_table').update({some_column: 10}).match({'id': 1});
    My result is: { error: [], data: null, count: null, status: 404, statusText: 'Not Found', body: null } Not sure if this is intentional and should be handled in some particular manner, or not.
    s
    • 2
    • 7
  • j

    jordan801

    09/07/2021, 2:25 AM
    This makes it so the error property can be one of three things, an Array, an error Object, or null.
  • j

    jordan801

    09/07/2021, 2:42 AM
    https://supabase.io/docs/guides/auth#:~:text=Managing%20User%20Data,storing%20user%20data. Think you need to go about that in a different way.
  • s

    soedirgo

    09/07/2021, 2:44 AM
    Error is empty array
  • n

    Neucoas

    09/07/2021, 2:48 PM
    Is there a way to build a query dinamically with the js client? For example, imagine we have a datatable and an input field to filter
    Copy code
    sql
    let query = supabase.from('users').select('name')
    
    if (name) query = query.filter('name', 'LIKE' `%${name}%`)
    s
    g
    s
    • 4
    • 9
  • n

    Neucoas

    09/07/2021, 2:48 PM
    This doesnt seem to be working on my end 😦
  • g

    GHOST

    09/07/2021, 2:54 PM
    The docs say to call this in your UI:
    Copy code
    js
    const { user, session, error } = await supabase.auth.signIn({
      provider: 'discord'
    })
    so I do, and it redirects the user to discord and because of this
    user
    ,
    session
    , and
    error
    aren't actually returned? how am I supposted to handle auth
  • s

    stibbs

    09/08/2021, 3:43 AM
    @User Did you add anything to handle the returned values
    { user, session, error}
    ? After they are redirected to discord, and they log in, it should be redirecting back to your url (or localhost)
  • m

    mornir

    09/08/2021, 6:10 PM
    Hi! Is the following code example from the documentation correct?
    Copy code
    const { user, session, error } = await supabase.auth.signIn({
      provider: 'discord'
    })
    // my code
    console.log('run!')
    When I run that function, it logs "run!" immediately and then I'm navigated away to discord.com for authentication and then I'm redirected back to my website, with the session and user data automatically set in localstorage. But I don't see how I'm supposed to get { user, session, error } directly in my JS code πŸ€” from examples seen on blog articles, it seems that the method "supabase.auth.onAuthStateChange" is used along with supabase.auth.signIn + provider
  • m

    mornir

    09/08/2021, 6:11 PM
    @User lol I have the exact same problem
  • m

    mornir

    09/08/2021, 6:13 PM
    my guess is that the docs are maybe inaccurate. since the user is leaving the website, there's no way to get a value back from supabase.auth.signIn
  • m

    mornir

    09/08/2021, 6:15 PM
    @User seems to be having the same problem
1...161718...81Latest