Freecodecamp: Advanced Node and Express - Set up Passport - Missing dotenv install instructions

Created on 11 Sep 2020  路  6Comments  路  Source: freeCodeCamp/freeCodeCamp


Describe your problem and how to reproduce it:
I am running Node.js on my own server.

Working through the Advanced Node and Express - Set up Passport challenge. The instructions tell you to "Be sure to add 'SESSION_SECRET' to your .env file and give it a random value", which I did.

I was getting an error "express-session deprecated req.secret; provide secret option", which debugged to the SESSION_SECRET variable being blank or undefined.

Further searches revealed that in order for .env to work, the dotenv library needs to be installed and configured. My understanding is that the old glitch environment would automatically import .env files, possibly Repl.it as well?

I found that in a later challenge there is this verbiage:
https://www.freecodecamp.org/learn/quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii

Do not forget to require and configure dotenv to use your environment variables.

This challenge also needs to be updated to include the same verbiage.

Add a Link to the page with the problem:
https://www.freecodecamp.org/learn/quality-assurance/advanced-node-and-express/set-up-passport

Tell us about your browser and operating system:

  • Browser Name: node.js
  • Browser Version: v12.18,3
  • Operating System: Ubuntu 18.04.5 LTS

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):

learn resolveshipping

Most helpful comment

@SaintPeter The repo has been updated now that the PR referenced by @Sky020 has been merged. It slipped through the cracks when production was deployed earlier today. Sorry for any confusion this may have caused. Let us know if everything seems to be present now, so we can close this issue. We will wait for your feedback.

Thank you.

All 6 comments

Thanks for bringing this up. This whole section was just updated, but the new boilerplate has not gone with it just yet (I had not realised these changes made their way into production).

The new boilerplate includes dotenv.

I found that in a later challenge there is this verbiage:
https://www.freecodecamp.org/learn/quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii

This challenge also needs to be updated to include the same verbiage.

The update has been very recent. So, I would suggest you start with the new boilerplate. Otherwise the tests will not work as expected. The line asking you to set up dotenv in the later challenge is just because camper is supposed to create a new file, and might not have dotenv.

@moT01 and @RandellDawson Can we get https://github.com/freeCodeCamp/boilerplate-advancednode/pull/11 merged?

Just to be clear:
Are you saying that the changes that went out for the /learn/curriculum, but that the corresponding changes had not yet been made to the boilerplate code?

but that the corresponding changes had not yet been made to the boilerplate code?

Yes. Well, the changes are made, but have not been merged. This is done, because once a PR is merged here (on the main repo), it is usually only pushed to production in a few days, but, with the boilerplate repos, a merge targets the branch used by campers. So, it is immidiate.

The means we wait for a main repo change to reach production, before merging the boilerplate, to, _ironically_, avoid this situation - confusion of mismatched boilerplate/lesson.

Well, I'm glad to be the canary in your coal mine, I guess. I'll watch that repo to see when the change has been merged.

Thanks!

@SaintPeter The repo has been updated now that the PR referenced by @Sky020 has been merged. It slipped through the cracks when production was deployed earlier today. Sorry for any confusion this may have caused. Let us know if everything seems to be present now, so we can close this issue. We will wait for your feedback.

Thank you.

Yup, Yup, it seems to be working properly now. I re-based against the current release and confirmed all of the libraries I expected were present.

Thanks all for the quick turnaround!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tzahile picture Tzahile  路  3Comments

vaibsharma picture vaibsharma  路  3Comments

SaintPeter picture SaintPeter  路  3Comments

kokushozero picture kokushozero  路  3Comments

raisedadead picture raisedadead  路  3Comments