HelmetJs submission link gets an error

Unexpected token < in JSON at position 0

I installed Helmet in the starter project on Glitch and it shows up in my package.json. When I enter the url and click “I’ve completed this challenge” I get that error.

You’re hitting a server error page: when you try to get the JSON from whatever endpoint is specified, what is coming back is a default HTML page saying something like error 500 something is wrong, or 404 page not found, or whatever. Check the URL is correct, and also have a look to see what is coming back.

Encounter the same error here. It seems like Glitch returns a HTML file instead of JSON. Waiting for a solution.

You can try click “Share” button and copy the link for “Share your App”. Then submit this link as solution. This helps me.

1 Like

Same problem … error in console comes as this.

2VM201:4 GET https://outrageous-cereal.glitch.me/_api/package.json 404 ()


install-and-require-helmet:1 Failed to load https://outrageous-cereal.glitch.me/_api/package.json: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://learn.freecodecamp.org' is therefore not allowed access. The response had HTTP status code 404.
VM201:4 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://outrageous-cereal.glitch.me/_api/package.json with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.

Solution is to use the new project set up as freecodecamp boilerplate. Follow link bellow .

https://glitch.com/edit/#!/import/github/freeCodeCamp/boilerplate-infosec/

The link above will generate glitch application set up to run on freecodecamp testing program.
If you just create new project on glitch and use that new project you going to have errors as Cross Origin Access Control and others.

Therefore create glitch project following

https://glitch.com/edit/#!/import/github/freeCodeCamp/boilerplate-infosec/

Install helmet and copy the link from Share -> Share your App then test it.
Works just fine and no more Cross origin error.

2 Likes

That worked for me - thanks for the help!