Tell us what’s happening:
Validation does not seem to be working. I have visited the /json endpoint and changed the conditions (associated with the MESSAGE_STYLE=uppercase variable in the .env file), and confirmed that the message changes (the way it should) in the browser. However, when I submit the solution, it fails. There are no errors in the console, nor are there any errors in the logs of the glitch project, itself. I’ve tried re-writing the function several different ways; they’re all error free, and they output the correct messages to the browser endpoint, but none of them will pass/validate when I submit to freecodecamp. I’ve been at it for days. Any new suggestions would be greatly appreciated. Thanks, everyone!
Your code so far
Your browser information:
User Agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36.
Challenge: Use the .env File Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
There was an issue with the testing script for this, but I was under the impression this was fixed.
So, just to see if it helps, could you try adding
https://www.freecodecamp.org to the
allowedOrigins array within
If that does not work, could you try adding the variables to your .env:
I tried both of those suggestions, but neither of them work, unfortunately.
Just to mention it: You have an extra space in the
I just corrected it, but still no success. I’m not sure if they are related, but I also cannot get the next 2 exercises (mounting and chaining the middleware) to pass successfully, either. I have completed all other tasks.
I am getting this error in the freeCodeCamp browser console:
Access to XMLHttpRequest at ‘
https://deserted-juniper.glitch.me/_api/use-env-vars’ from origin ‘ https://www.freecodecamp.org’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
I might have confused the
DISABLE_XORIGIN variable. Set it to
Sorry for making you go back and forth.
I tried submitting it after changing DISABLE_XORIGIN=true to DISABLE_XORIGIN=false, but it still did not pass.
No worries about sending me back and forth. I am very grateful you are taking the time to help me with the issue!
I’ll gladly take any other suggestions you may have.
Hey there, change this:
It worked for me.
Out of interest, when did you clone the boilerplate? Recently, or did you clone it a while ago?
Where do I put this “fcc-express-bground”: “
https://github.com/freeCodeCamp/fcc-express-bground-pkg.git” syntax you’re suggesting? Do I replace the
var bGround = require(‘fcc-express-bground’);
in the server.js file?
I started this set of exercises 3 or 4 days ago.
I tried replacing what I had in the server.js file, as well as in the package.json file with the syntax you suggested. It still won’t validate, though.
Sorry, I should have been more specific.
I suggest you remove the other .env variables I told you to add, and your package.json should look like this:
"start": "node server.js"
It WORKED! Thank you! YOU ROCK!!!