https://supabase.com/ logo
Join Discord
Powered by
# off-topic
  • m

    moein

    01/08/2022, 8:09 AM
    It comes with a nice trick to even keep your webhooks in your migration files
  • g

    gleki

    01/08/2022, 10:20 AM
    is it possible to insert rows only via a function but not via direct "insert into" calls? in other words can i restrict policy for direct inserts but enable permissible policy for a function that would ultimately do the insert?
    f
    • 2
    • 6
  • n

    nixfixbix

    01/08/2022, 2:52 PM
    Question: I have server endpoint for inviting new users. Say I want to invite users with some initial settings, e.g. first name, last name etc. Is it possible to do that with a single call from my server or do I have to invite the user and then create then insert data for e.g.
    public.profiles
    ? The issue doing it in two calls is if the second request fails - that's kind of a broken state. I'd prefer to have some plsql triggers but I don't see how the trigger could have access to the additional data since it's not available on
    auth.users
    . I hope it makes sense?
  • m

    moein

    01/08/2022, 3:23 PM
    @User I might be wrong but my understanding is that it all depends on who is executing the function. If it's executed by a user through rpc or called because of a trigger through a user interaction it's still bound to that user and the same policy is applied to that function.
  • m

    moein

    01/08/2022, 3:26 PM
    You can create a trigger for after insert on auth.users which creates the profile. For some reason auth tables do not appear when you use supabase interface but I just tested and you can create the trigger through a query.
  • n

    nixfixbix

    01/08/2022, 3:27 PM
    Already doing that but the trigger doesn't have access to the additional data I want to provide
  • m

    moein

    01/08/2022, 3:35 PM
    You can do the following: Create a table called auth.users_metadata which has the email column and any other column you need to keep the data So first you insert user's data in that table and then with the trigger you read from auth.users_metadata and create the real profile This way if the creation of profile fails the invitation won't go through 😃
  • n

    nixfixbix

    01/08/2022, 3:36 PM
    is an email invitation sent when auth.users is inserted?
  • m

    moein

    01/08/2022, 3:38 PM
    I believe so I remember I had a faulty function on after insert on auth.users and when I tried to invite a user the whole invitation was failing You could easily try that with throwing an exception in your function and see if the invitation fails
  • h

    HarryET

    01/08/2022, 4:58 PM
    👋🏼
  • o

    Olyno

    01/08/2022, 4:58 PM
    Hi You should share it in #867347909741248532 instead, it's more adapted :p
  • n

    nixfixbix

    01/08/2022, 5:28 PM
    Thanks for your help
  • n

    nixfixbix

    01/08/2022, 9:32 PM
    Just a follow-up. This does not work since you won't send any emails this way. To me it seems you send emails and create users by requesting
    /invite
    on the gotrue service - source code here: https://github.com/supabase/gotrue/blob/master/api/invite.go. I don't think there is a way to do that in a transaction with creating user profile data as well
  • n

    nixfixbix

    01/08/2022, 9:39 PM
    How does one set
    raw_user_meta_data
    when inviting a user?
  • n

    nixfixbix

    01/08/2022, 10:16 PM
    To answer my own question:
    serverSupabase.auth.api.inviteUserByEmail("john@doe.com", {data: {....})
    <-
    {...}
    will be added to
    auth.users.raw_user_meta_data
    (and can then be used in triggers).
  • l

    logemann

    01/09/2022, 10:37 AM
    thats exactly how i do it ... triggering and transfering data from raw_user_metadata to my own users table
  • l

    logemann

    01/09/2022, 1:23 PM
    Man... the documentation of supabase is really their weak point. So many things you need to reveal via source code.
  • g

    gleki

    01/09/2022, 3:23 PM
    I want to rate limit the amount of records a user can insert into the db per day. Triggers is the way to go?
  • g

    Gaurav

    01/09/2022, 3:37 PM
    I have no project under my org but it won't let me create a new project
  • h

    hero76

    01/09/2022, 5:04 PM
    guys anyone successfully self hosted supabase? any complete production guide? thanks
  • s

    sockenguy

    01/09/2022, 5:28 PM
    Hi, guys are auto-incremented Postgres ids just like in MySQL for instance, incrementing from 1. Or should I use a unique id similar to mongo?
  • h

    hero76

    01/09/2022, 5:50 PM
    @User you can use uuid if you want, auto generated
  • u

    user

    01/09/2022, 6:09 PM
    UR ON TIKTOK? LET'S GOOOOOOO
  • s

    sockenguy

    01/09/2022, 7:29 PM
    how would I need to set seeder? Is there an option for UUID aswell?
  • h

    hero76

    01/09/2022, 7:30 PM
    just set it has shown in my screenshot, its already there
  • h

    hero76

    01/09/2022, 7:30 PM
    uuid_generate_v4()
  • s

    sockenguy

    01/09/2022, 7:59 PM
    oh right^^
  • g

    Gaurav

    01/09/2022, 9:20 PM
    Even delete a old project to see if that would fix it (should have repurposed that instead in hindsight)
  • g

    Grymer

    01/09/2022, 10:44 PM
    Hello people! Is it possible to remove a folder on Supabase storage? Like .remove(['someFolder'])?
  • g

    Grymer

    01/09/2022, 10:45 PM
    I keep several sizes of images stored, and they're kept in a folder with the ID. It would be nice to be able to just remove the folders rather than each file (Which also leaves me with a ton of empty folders)
1...176177178...392Latest