https://supabase.com/ logo
#help
Title
# help
m

magicbyt3

03/30/2022, 1:36 PM
Hi there, I am getting an 404 error when I try to update a record and I am wondering why that happens. Any ideas what is going on?
Copy code
js
async function update(newData) {
    const objId = newData.id;
    const { data, error } = await supabase
        .from('addresses')
        .update({city: newData.city})
        .eq('id', objId);

    console.log(data, error)
    if (null !== error) {
        return false;
    }

    return true;
}
data is null and error is an empty array. Reponse http is 404 but I have no idea why it happens at all. The record with the id (1) exists in the table and everything is spelled correct.
n

Needle

03/30/2022, 1:36 PM
Hello @magicbyt3! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
d

debabrata

03/30/2022, 1:38 PM
Are RLS policies being violated for the table?
n

Needle

03/30/2022, 1:38 PM
magicbyt3 (2022-03-30)
m

magicbyt3

03/30/2022, 1:39 PM
ah missed them. briefly disabled RLS and update happens. Alright will debug my RLS for the table then. Thanks 🙂
okay some check returned false on permissions. Works fine now. Thanks again.
n

Needle

03/30/2022, 1:42 PM
Thread was archived by @magicbyt3. Anyone can send a message to unarchive it.
d

debabrata

03/30/2022, 2:09 PM
Cool. You're welcome!