Using supabase in express not getting errors

I am using supabase in a simple express api simply to learn express. I can't seem to throw an error.

app.get('/api/get-book-by-id/:id', cors(corsOptions), async (req, res) => {
  const {data, error} = await supabase
    .from('books-express')
    .select('*')
    .match({id: req.params.id})

  console.log(error)
  console.log(data)

  if (error)
    res
      .status(404)
      .send({message: `ERROR CODE: ${error.code}: ${error.message}`})

  // res.send(data)
})


I can return
data
with the correct book ID if present but if not I just get an empty array...but errror is
null
surely this should be throwing an error saying no id of x is present
Was this page helpful?