swiss
08/17/2021, 1:24 AM{
hint: null,
details: null,
code: '42703',
message: 'column "0" of relation "intervals" does not exist'
}
Couldn't find anything on this, and I even temporarily removed my relation keys from the tables to just see if plain inserting something would work but I'm still getting the error. Any ideas why this is happening? If it helps, here's my next.js api route code
// req.body is an object containing the fields I want the row to have
console.log("REQ: ", req.body)
const { data, error } = await supabase
.from("intervals")
.insert([req.body])
if (error) {
console.log(error)
res.status(404)
}
console.log("NICE: ", data)
res.status(200).json(data)
silentworks
08/17/2021, 2:57 PMreq.body
, as I am sure it has data in there which isn't part of the table you are trying to insert into. Also you have wrapped it with an array, this could be an issue if req.body
doesn't have multiple objects inside of it.swiss
08/17/2021, 11:11 PMreq.body
is a single object with the 1 required prop for the insert. In regards to the array, the supabase docs example for the insert
method use an array to insert only one object as well, and I'm pretty sure it worked for another table I have where I tried to insert rowssilentworks
08/18/2021, 4:17 AMreq.body
has a property of 0 which is not a column in the intervals table. So it’s either req.body
is empty or it actually contains that column.