kelektiv/node.bcrypt.js

bcrypt 5.1.1- ERR_UNHANDLED_REJECTION even with .catch()

bauerbach opened this issue · 1 comments

bcrypt version: 5.1.1

When I use bcrypt.compare, even with .then() and .catch(), my server crashes with the following error:

node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^

[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 "#".] {
code: 'ERR_UNHANDLED_REJECTION'
}

If I omit the "err" part and use callbacks, the result is undefined.

I expect the .catch() to actually catch the error. Therefore, I think the compare function itself lacks a catch block in the latest version.

It turns out there was an error in my code. Closed issue.