Basic Node and Express - Use the .env File

Tell us what’s happening:
Cannot pass the test even if I got the correct response… I have already looked for other similar issues and trying different version of the code, still I cannot pass it!

Your project link(s)

solution: boilerplate-express - Node.js Repl - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic Node and Express - Use the .env File

Link to the challenge:

I don’t see nothing in the console

Now when I click to start the test this happen:
SyntaxError: Unexpected token M in JSON at position 0
at JSON.parse ()
at /home/runner/boilerplate-express/node_modules/fcc-express-bground/index.js:101:35
at IncomingMessage. (/home/runner/boilerplate-express/node_modules/fcc-express-bground/index.js:33:7)
at IncomingMessage.emit (node:events:390:28)
at (node:internal/streams/readable:527:10)
at flow (node:internal/streams/readable:1012:34)
at resume_ (node:internal/streams/readable:993:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
throw new ERR_HTTP_HEADERS_SENT(‘set’);

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at new NodeError (node:internal/errors:371:5)
at ServerResponse.setHeader (node:_http_outgoing:576:11)
at ServerResponse.header (/home/runner/boilerplate-express/node_modules/express/lib/response.js:794:10)
at ServerResponse.send (/home/runner/boilerplate-express/node_modules/express/lib/response.js:174:12)
at ServerResponse.json (/home/runner/boilerplate-express/node_modules/express/lib/response.js:278:15)
at /home/runner/boilerplate-express/node_modules/fcc-express-bground/index.js:113:15
at IncomingMessage. (/home/runner/boilerplate-express/node_modules/fcc-express-bground/index.js:33:7)
at IncomingMessage.emit (node:events:390:28)
at (node:internal/streams/readable:527:10)
at flow (node:internal/streams/readable:1012:34) {
exit status 1

sorry, I’m just experimenting with the code … I m gonna put it back

nothing, I noticed after that need to use secret tab for that to work in repl

anyway I see that cannot be used MySecret == “uppercase”
it says “MySecret is not defined”

Yes and there is a reason for that. You have a typo.

All good, test passed! Thanks!

At least It was useful to start using this forum :))

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.