Prisma client method can not catch error?


#1

So I have an endpoint to delete a comment like this:

app.delete('/comments/:id', checkIdToken, (req, res) => {
    prisma.deleteComment({
      id: req.params.id
    }).then(() => res.sendStatus(204))
      .catch(err => res.status(400).json(err))
  })

This is my model:

type Comment {
  id: ID! @id
  content: String!
  post: Post! @relation(name: "PostComment", link: INLINE)
  owner: UserProfile! @relation(name: "UserComment", link: INLINE)
  replies: [Comment!]! @relation(name: "Reply", onDelete: CASCADE)
  parent: Comment @relation(name: "Reply", link: INLINE)
}

There is no problem when I pass an existing comment id to the endpoint. But when I pass it a random string the deleteComment Promise does not reject any error. Instead it got timeout after a few seconds.

I’d really appreciate any idea how to fix this.
Thanks a lot!


#2

Ref: https://github.com/prisma/prisma/issues/4179


#3

@pantharshit00 Can you elaborate? I still don’t understand how this issue is related with my problem.