Can't pass the "Use the .env File" challenge!

Hello everyone.
I’ve just read other’s issues on this challenge and none of them help.
I can’t find the problem.
• environment variable is set
• everything works when I test them on
• links are correct
I can not pass! WHY?

My Solution on replit

var express = require('express');
var app = express();
let mySecret = process.env['MESSAGE_STYLE'];

app.get("/", (req, res) => {
  app.use('/public', express.static(__dirname + '/public'));
  res.sendFile(__dirname + '/views/index.html');

let response = {};
app.get("/json", (req, res) => {
  if (mySecret === "uppercase") {
    response["message"] = "Hello json".toUpperCase();
  } else {
    response["message"] = "Hello json";

My browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge Name: Use the .env File

Link to the challenge:

You are checking the value of the secret out here, but that means that this variable is set once and never changed. The tests tell your application to update this secret, but that change never makes it way into this variable because this line is only run once.

1 Like

should I create an empty .env variable in SECRETS section?

OH!!! I shouldn’t create an env variable there! I just need to call the variable mentioned in the instruction. The rest will handle when FFC testing my solution

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