PricingBlog

Supabase RLS issues on Inserting new row

  • alexsiale_17363-1275034796174606376

    Alex

    1 year ago

    Can anyone help me, maybe @Lucas G again... with my RLS new row error?

    I feel like it's set up correctly. It works if I diasble RLS, but then errors when enabled again, so it's obviously the way I've set up the policy thats the issue.
    1275034796514349107-Screenshot_2024-08-19_at_10.07.59_PM.png
    1275034796804018286-Screenshot_2024-08-19_at_10.07.41_PM.png
    1275034797168787530-Screenshot_2024-08-19_at_10.12.50_PM.png
  • alexsiale_17363-1275035530597236829

    Alex

    1 year ago

    Do I need to add the owner_id through the API call in the object in the body? Or does that get added automatcially?
  • alexsiale_17363-1275036596474875976

    Alex

    1 year ago

    Okay, added user_id to the body and it worked. I'll keep this here if anyone else comes into this issue.
    🔥1
  • nix.nz-1275041326467121212

    Marko

    1 year ago

    Awesome, thanks for updating the thread. I'm setting up a similar scenario for my app so this will be handy to know 🙂

    Hi from NZ as well, by the way 🙂
    ❤️1
  • alexsiale_17363-1275042542894710795

    Alex

    1 year ago

    Awesome!
  • lucasg-1275088069262835733

    Lucas G

    1 year ago

    @Alex and @Marko yes, you'll need to send the user id along if you set it up like this
  • Something else you can do is have the owner_id column default to auth.uid()
  • Then it'll be automatically filled in with the id of the user making the call
  • alexsiale_17363-1275159840393531533

    Alex

    1 year ago

    Yeah that’s sounds more efficient