Challenge Keeps Failing - Add Helmet to Glitch Project

I’ve added Helmet to the package.json file as a dependency, but the challenge keeps failing. I get the message ‘“helmet” dependency should be in package.json"’… does anyone know why? I’ve never gotten this issue with any other Glitch project I’ve created so far for the other challenges.

Thanks!

Nevermind I figured it out.

What was going wrong for you?

I’m stuck in the first lesson - Information Security with HelmetJS - Install and Require Helmet. I’ve reviewed my code over a week now and can’t seem to figure out what’s wrong.

I installed the dependency in my package.json file:

{
“name”: “fcc-infosec-challenges”,
“version”: “0.0.1”,
“description”: “fcc backend boilerplate”,
“main”: “server.js”,
“scripts”: {
“start”: “node myApp.js”
},
“dependencies”: {
“express”: “^4.14.0”,
“helmet”: “^3.8.1”
},
“engines”: {
“node”: “4.4.5”
},
“keywords”: [
“node”,
“hyperdev”,
“express”,
“freecodecamp”
],
“license”: “MIT”
}

And required helmet in myApp.js file like so:

/**********************************************

    1. Applied InfoSec Challenges
  • =============================
    ***********************************************/

var express = require(‘express’); // Do Not Edit
var app = express(); // Do Not Edit

// ----

/** - Challenges - *
********************/

/** 1) Install and require helmet */

// Helmet helps you secure your
// Express apps by setting various HTTP headers.
// Install the package, then require it.

var helmet = require(‘helmet’);

Thank you!

After many repetitive and enduring tries, it came down to this:

Switched from Google Chrome to Safari and the test passed.

:alien:

Wow, I just got stuck on this one too! I tried switching browsers but it didn’t help.

Without changing any code, I realized the URL was the problem:
https://... works and
http://... doesn’t.

I am currently starting the same challenge and I am facing a similar problem. The difference is that I want to use Github instead of Glitch. Tests will always fail but when looking at the developer console I assume that it is because it has problems loading the package.json file from Github. Do I understand correctly that I can use the URL to my (public) Github repo instead of the glitch URL?

I base this thought on the first line of the Sec challenge: " As a reminder, this project is being built upon the following starter project on [Glitch], or cloned from [GitHub]."

I don’t think it will. They say: “Note: Be sure to submit the link to the live demo of your project.”
Their test will GET /api/package.json for the file, so it does need a live app to pass the test.

But I personally dislike Glitch, so I hosted on Heroku. Although the api does work and return the package,json with the dependency, I cannot pass the test. Go figure…

Edit: Never mind, a spelling error.

var helmut = require('helmut');

instead of:

var helmet = require('helmet');

Obvious now, but not for the past hour or so !

After successfully fixing a typo in my code, the test on challenge 1 (using ‘helmet.hidePoweredBy’ ) keeps failing for no obvious reason.

I suspect it may be related to the problem you mention, so, could you elaborate on your solution ?

Would it, perhaps, require altering the code at the bottom of ‘myApp.js’ ? If so, any hints ?

EDIT: No changes required to any code, nor does a different browser need to be used.

Submission(s) fail upon 1st submission, but if re-submitted, will succeed on the 2nd or 3rd submission.