Bcrypt compare (only this method) crashing node application on Docker.
Recently I'm using node:alpine on my Dockerfile, after that bcrypt.compare started failing & it's crashing the server.
This went wrong - bcrypt.compare not working with node:alpine This should happen? - Login should have proceeded, my code is alright: const isUserPassword = await bcrypt.compare(password, user.pwdHash) Version of nodejs and OS? Docker with node:alpine as the base image and OS Windows which is irrelevant in case of Docker.
Even doing the build from source or restarting docker service, the error persists :/
I tried to solve it myself, but even inside the try-catch block, the error log is not displayed. Very strange because it's just the 'compare' method, I can generate the hash normally
Here is my dockerfile:
WORKDIR /usr/app
COPY package*.json .sequelizerc ./
RUN apk --no-cache add --virtual builds-deps build-base python
RUN npm install
RUN npm rebuild bcrypt --build-from-source
COPY . .
EXPOSE 3333
CMD ["npm", "run", "dev"]
Are you copying node_modules inside the container from outside? Ideally, you should have the node_modules in the .dockerignore
I have .dockerignore file with node_modules inside. Isn't it. I tried to change from alpine image to another, and it works, but i need to know what's going on :/
Can you try with the new v5.0.1?
Sometimes there are some ABI incompatibilities between different versions of alpine and it is hard to detect
I Tried and isn't work, but I left the alpine version and went to node: latest and everything worked normally