Basic Node use .env file test fails with status 500

Tell us what’s happening:
I’m getting a 500 response when submitting my repl url from fCC.
When accessing the endpoint in the browser, the correct json object is returned.

app.get("/json", function(req, res) {
  let response = "Hello json"
  if(process.env.MESSAGE_STYLE == "uppercase"){
    response = response.toUpperCase();
   res.json({"message": response});

Your project link(s)


Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

Hello there,

You should not be submitting:

The URL must always be the root (home) URL of any project you submit for all challenges.

Other than that, your code looks correct, but this challenge is broken for most users. See: Use the .env File - Issue - freeCodeCamp Support - The freeCodeCamp Forum

Hope this clarifies

It breaks (500) with the root URL as well.

In that case, see the linked issue above.

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