I've got a difficult error in a Remix loader. A prisma query seems to be throwing an error, but it's not being caught by my try/catch block. Here is the code:
try {
console.log('here');
const matchingRecord = await prisma.adminInvite.findFirst({
where: {
email: result.data.email,
token: result.data.token,
},
});
console.log('here2');
} catch (error) {
console.log('here3');
}
When this part of my code gets executed, the server output is as follows:
here
GET /app/admin/accept-invite?invite=54abc7771a76dabd4fbfd7f6211211995c6c61f731ff9e110719c05c56c4bdf7be505a7260e9a60aaa1c299b0da9496e3890b392bbbcbe448d024db6a91a1ae76696dcf399dc9927cef7a0492f919f59d6b3d185d1b93fd37ca3c74dc86416d5dd178f1cc4fe143563c60cc60de26e3360321f1fa1b9cd56d087a23d57290088d07964f7dc3267e25c4fc5cb15a548abb592dc7938924ccc018a4fd48353c1bf559d6cf0a821457f8c7a0f3aa008b3cd 302 - - 26.915 ms
UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<NodeResponse>".
It never seems to even get inside the catch block, and I have no idea why.