i am having an issue with uploading avatars to my supabase bucket as its giving me "new row violates row-level security policy for table "objects"". I tried other StackOverflow solutions and nothing. Before trying to upload I log in using supabse so my user is authenticated yet its still not letting me upload. I added this policy in storage.objects:
(role() = 'authenticated'::text)
and clicked the insert button. Does anyone know what I am doing wrong? I assume its something to do with the policies. Thanks
this is how I'm trying to upload my avatar:
try{
const { data, error } = await supabase
.storage
.from('/public/avatars')
.upload(`${values.email}.png`, values.avatar, {
cacheControl: '3600',
upsert: true
});
if(error) throw error;
}catch(error){
console.log(error);
}