SupabaseS
Supabase4y ago
Greg

'new row violates row-level security policy for table tickets

Hey i have rls setup with these three options it can only update or select if (uid() = id) and can only insert when authenticated. but when i send in an insert statement from my program i get code: '42501', details: null, hint: null, message: 'new row violates row-level security policy for table "tickets"'

this was my function. the user is signed in
export async function createTicket(ticketdata:any) { const { data, error } = await supabase .from('tickets') .insert([ { devicetype: ticketdata.deviceType }, { issuedetails: ticketdata.issueDetails }, { issuetype: ticketdata.issueType }, { priority: ticketdata.priority }, { ticketname: ticketdata.ticketName }, ], { returning: 'minimal' }, { upsert: true }) if (error) console.error(error) else console.log(data) }
Was this page helpful?