Tell us what’s happening:
Hi everyone,
I’ve been working on the Bcrypt exercise in the Advanced Node and Express course, and no matter what I try, the tests won’t pass. Here’s everything I’ve done so far:
Installed Bcrypt as a dependency:
npm init -y
npm install bcrypt
Verified that bcrypt is listed under “dependencies” in package.json.
Added the require statement in the main file:
const bcrypt = require(‘bcrypt’);
Renamed the file from server.js to index.js because FreeCodeCamp requires that exact filename.
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Challenge Information:
Information Security with HelmetJS - Understand BCrypt Hashes
Update:
I’ve double-checked everything and even looked through recent forum posts. It seems this might not be an isolated problem:
Other learners also report the test failing even when bcrypt is installed in package.json and required correctly in server.js.
Some people mentioned that using the old boilerplate instead of the new one can cause the tests to fail.
A few said the tests eventually passed after refreshing/retrying, without changing any code.
One user fixed it by enabling CORS so the FCC test runner could read their project files.
Here’s my repo again for reference: GitHub - brisam007/freecodecamp-bcrypt: Bcrypt section of FreeCodeCamp information security tutorial
At this point, I’m wondering if the issue is on the FreeCodeCamp testing side rather than my code. Could a moderator or anyone confirm whether this is a current bug, or if I still need to adjust my setup?
Thanks again for the help!
Hi everyone,
Good news!
I finally got the Bcrypt tests to pass. The main fix was adding CORS to my server so the FreeCodeCamp test runner could access my project. Here’s what I did:
const cors = require('cors');
app.use(cors());