Bcrypt compare not available

Hello - I am needing to use bcrypt.compare function from the bcrypt library. I have the cdn minified version of the bcrypt library added into the app. However, no matter what I try, it will not allow me to use the compare function from the bcrypt library.

Here is the library that I loaded the app->settings->library area:
https://cdnjs.cloudflare.com/ajax/libs/bcryptjs/2.2.0/bcrypt.js

And here is some code I am trying to run:

const bcrypt = import("bcrypt");
const passFromDB = getUser.data.password[0];
const userPass = txtPass.value;

const passwordMatched = await bcrypt.compare(userPass, passFromDB);

console.log("testing password matching: " + passwordMatched);

if(passwordMatched) {
         // do something here
}

we have a legacy DB that we are having to pull from to verify a user on a different system (they still have to verify as being a retool user).

How do I go about using this library in my codebase? Thanks!

Hi @macphreak!

Very odd, are you able to run other functions from the bcrypt library and .compare is the only one that doesn't work?

Let me try to load in the library the same way and see if it works for me. Library integrations are tricky to debug in Retool unfortunately.

I find that sometimes either removing/deleting the library and trying again will fix a bug and other times a different version of the library may be needed :melting_face:

Hi @macphreak,

Did some testing trying to install different versions of bcrypt and this seems to be a bug on our end.

Just filed a bug report. Will let you know what I hear back from the engineering team and if there are any work arounds.

1 Like

That’s good to hear. Hopefully it will be an easy fix. Thanks!