In the second module of the HelmetJS section, the application will not pass the test despite having code fully correct. I even went to copy the code directly from the HelmetJS docs and it still will not pass. I have installed and required HelmetJS correctly in order to pass the test from the previous challenge and now the test for the second challenge fails and just says "expected 'Express' to not equal 'Express.'"
If I just call app.use(helmet()) then I get a different error that seems to be more accurate as to what should return an error. I have not found any solution that satisfies the test case.
Upon inspecting the header in the Chrome Dev Tools, it appears that the code is working correctly and the x-powered-by has been set to 'PHP 4.2.0' like it should have been. This makes me assume that the test is just always failing and returning that error message regardless of the actual header.
This challenge is the one that will not pass the test case.
Upon waiting a few minutes and just submitting the test again, it then accepts the solution. I had tried submitting multiple times in a row and that didn't seem to fix it, but waiting a few minutes and testing again with no modifications to the code seemed to do the trick.
Same exact situation here.
Facing the same issue, I was like going crazy, thanks @jacobvarner for the thread.
I am able to get through it after waiting for a while.
May I know, Is this reproduced in other browsers?.
The issue stems from the boilerplate - the api always returns 'Express' the first time it's called. The work around is to submit your challenge twice as discussed above. Waiting _should_ not be necessary. Not beyond waiting for the first submission to fail.
As for a solution - it's necessary to change server.js to use express.Router(). I have a PR ready to go, but first I need to check this doesn't break something elsewhere!
I was also experiencing some trouble with this bug until I read this Issue. Waiting for a while to test the solution allowed me to move on.
@karikalanarun I was able to reproduce the error in Firefox 72.0.1. However, helmet updated the headers as expected when I call app.use(helmet.hidePoweredBy({ setTo: 'PHP 4.2.0' }));
:
I had the same issue, you can resolve it by using a previous version. Go to your package.json file and use version 3.21.1 anything more recent has the same.issue.
@this-isnt-me You are a lifesaver. I was having the same issue to and the version helped me out and marked the challege as completed by changing the version from 4.0.0 to another previous version like 3.21.1 to fix the helmet.hidePoweredBy() middleware should be mounted correctly
. error i kept getting. my code was right but the FCC site was just not letting me submit my glitch project link URL.
Browser Name: FireFox
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
This should be fixed now via https://github.com/freeCodeCamp/freeCodeCamp/pull/39194 - so I am going to close this. If anyone is still having problems, feel free to make a comment and we can reopen it. Thanks and happy coding 馃帀
Most helpful comment
I had the same issue, you can resolve it by using a previous version. Go to your package.json file and use version 3.21.1 anything more recent has the same.issue.