kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.38k stars 510 forks source link

bcrypt 5.1.1- ERR_UNHANDLED_REJECTION even with .catch() #1035

Closed bauerbach closed 2 months ago

bauerbach commented 2 months ago

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.

bauerbach commented 2 months ago

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