https://supabase.com/ logo
Join DiscordCommunities
Powered by
# javascript
  • u

    user

    01/15/2022, 4:13 PM
    Hey guys, so I've got a bucket with folders that are only accessible to their corresponding user. These folders have images in them, and I need to have access to all a user's images on load, but the docs only show me how to get the signed url of a single object. I've looking through the documentation and found nothing. and I've even tried using the user's access token to generate a url myself to no avail. So yeah, is what I want to do possible?
  • g

    garyaustin

    01/15/2022, 11:46 PM
    Unless you have your user images in a public bucket, you will have to request a signed URL in a loop for each one. Of course in a public bucket, if someone guesses the URL they have access. You can use from.list with a path to get the file reference in their directory to then use to get signed URL.
  • u

    user

    01/16/2022, 8:03 PM
    Yeah that's what I'm currently doing, but it's horribly slow with the amount of images I need. Probably just going to build a tiny custom solution in express or something but yeah, thanks a tonne for taking time out of your day to help.
  • d

    Darryl

    01/16/2022, 9:16 PM
    Hey everyone I'm running into this problem where I'm not pulling the latest image from an updated bucket https://twitter.com/darryl_codes/status/1482819182651932673?s=20
  • j

    jetpackjoe

    01/16/2022, 11:22 PM
    is there a way to clear/expire a user's accessToken?
  • b

    Bogdwynny

    01/17/2022, 9:00 AM
    They’re JWT tokens and they can only expire when you set them in auth settings, you can’t clear or expire a token
  • b

    BenXk

    01/17/2022, 4:42 PM
    Hello, I have a json array and I would like to get the username of the author returned with the rest of the data
    Copy code
    [{"comment":"Hello","author":"2aa439fd-77b0-448f-8ab7-ad26a0a0b5b3"}]
    s
    • 2
    • 19
  • b

    BenXk

    01/17/2022, 4:42 PM
    I have tried
    replies:author ( username )
    so I can get the author but how can I get comment too?
  • s

    Scott P

    01/17/2022, 4:57 PM
    Getting additional data with supabase-js
  • j

    jetpackjoe

    01/18/2022, 3:25 AM
    I am having trouble with RLS. I am calling
    await supabase.auth.setAuth(accessToken)
    followed immediate by
    await supabasea.from('mytable').select()
    When I turn RLS off, I get data, with RLS on, I get
    []
    for some reason
    setAuth
    is returning
    {access_token: "...", token_type: 'bearer', user: null}
    when I pass the same access token to
    supabase.auth.api.signIn
    , I get a user back... so I know the token is good... but trying to figure out why
    setAuth
    is returning a null user and why RLS isn't working
  • j

    jetpackjoe

    01/18/2022, 4:28 AM
    my RLS policy was wrong. solved.
  • u

    1304654

    01/18/2022, 9:03 AM
    🐛POSSIBLE BUX 🐛 Given a composite two keys (uuid) into database for example one table with OrderDetail with ProductId, OrderId, when I go to insert a list of OrderDetails with:
    await supabaseClient.from("order_detail").insert(order_details);
    It throws the next error:
    details: "Key (order_id)=(f11e232a-9010-405a-94ed-9363765fc6d9) already exists."message: "duplicate key value violates unique constraint \"order_detail_order_id_key
  • u

    1304654

    01/18/2022, 9:05 AM
    order_details=[{order_id: 'f11e232a-9010-405a-94ed-9363765fc6d9', product_id: "a93935ff-ade8-4acc-ac7e-aacc5dfe1961"},{order_id: 'f11e232a-9010-405a-94ed-9363765fc6d9', product_id: "c4cc5857-6bce-4b10-818c-acfb87f3a4f9"}]
  • u

    1304654

    01/18/2022, 9:06 AM
    Why it't no possible add multiple rows with composite key?
  • u

    1304654

    01/18/2022, 9:45 AM
    I fix it creating a new table ( no copy) and it works. It sames that there are some kind of inconsistency between supabase web ui table editor and the instance data base.
  • g

    Geggs

    01/19/2022, 1:34 PM
    Hey, im currently setting up Supabase auth in a Expo/React Native project. Was just wondering if anyone has had any luck with persisting the session with AsyncStorage? It does not seem to work after following the examples provided.. Closing or refreshing the app logs you out, and the storage is always empty..
  • g

    Geggs

    01/19/2022, 3:57 PM
    Will also add this only happens with phone auth, email works fine..
  • j

    jaf

    01/20/2022, 12:48 PM
    How do I use the
    onConflict
    option when doing a mass insert? What syntax do I need to use? I have a composite unique constraint that consists of two columns. I'm periodically inserting the whole data set and want to just ignore the row if it already exists (or maybe update the
    updated_at
    column). One tutorial I found suggested the following:
    Copy code
    ON CONFLICT ON CONSTRAINT customers_name_key 
    DO NOTHING
    So how would I write that with the supabase JS library?
    s
    • 2
    • 3
  • t

    TremalJack

    01/20/2022, 1:32 PM
    is possible run a fetch in distinct or using group by?
  • t

    TremalJack

    01/20/2022, 1:33 PM
    like supabase.from('table').select('distinct(value)') ?
  • s

    Steve

    01/20/2022, 2:08 PM
    on conflict do nothing
  • j

    Jaeden

    01/21/2022, 10:06 AM
    I have a relational table with many stats. How can I have
    stats( * )
    return only the last item? Right now I get an array of thousands of entries. Am I overlooking some syntax for quering foreign tables?
    Copy code
    return await supabase.from<WatchlistData>('watchlists').select(`*, items:watchlist_items(*, data:projects(*, stats( * ))), creator:profiles(*)`).eq('id', watchlistId).single()
  • j

    Jaeden

    01/21/2022, 10:27 AM
    Figured it out. Key is to use
    limit()
    with a foreignTable
    Copy code
    return await supabase.from<WatchlistData>('watchlists').select(`*, items:watchlist_items(*, data:projects(*, stats( * ))), creator:profiles(*)`).limit(1, { foreignTable: 'stats' }).eq('id', watchlistId).single()
  • j

    jaf

    01/21/2022, 5:32 PM
    It looks like deleting multiple records with one call is not possible: https://supabase.com/docs/reference/javascript/delete Is that correct?
  • j

    jaf

    01/21/2022, 5:44 PM
    What's the suggested way to delete multiple records?
  • g

    garyaustin

    01/21/2022, 6:06 PM
    .delete() .in('id', ['id1', 'id2', 'id3']) Or any filter you want. Hint... be careful your filter does exactly what you expect...
  • j

    jaf

    01/21/2022, 6:58 PM
    I see, the filters are the secret. Thanks a lot
  • j

    jonahcockshaw

    01/21/2022, 10:35 PM
    Hey guys, newbie here. How easy it is to setup auth. with stripe billing on Supabase? Planning to use Javascript. I’ve never done auth or billing before so I’ve got a lot to learn. Keen to know what the main challenges will be / where I can find best guides and resources ❤️
    s
    • 2
    • 1
  • m

    ManishShahi

    01/22/2022, 6:15 AM
    I am using supabase on sveltekit. And On using the following code to retrieve all rows in onMount I am getting result as undefined. Code: onMount (async () => { let { data, error } = await supabase.from('users').select('*'); console.log(data); }); Please help.
    s
    • 2
    • 2
  • s

    silentworks

    01/22/2022, 5:18 PM
    How to setup stripe and auth with supabase
1...434445...81Latest