Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6129

webapp works fine on windows, on ubuntu droplet I get this error: express-session deprecated req.secret; provide secret option,

$
0
0

Using an Ubuntu droplet from DigitalOcean, When I try executing the index.js file that starts the server, I get this message: "express-session deprecated req.secret; provide secret option server/index.js:20:2"

I built this application on Windows and works just fine but on Ubuntu, I'm getting this message.

I have .env installed and have my SESSION_SECRET configured on that file but still getting that message and my server won't even load.

I tried putting the session secret key into the js file directly but that does not work either and also defeats the purpose of a secret. also tried exporting an object as a session secret but that gave me errors. (index.js:20:2 is secret: process.env.SESSION_SECRET)

const express = require("express");const { pool } = require("../config/dbConfig");const bcrypt = require("bcrypt");const session = require("express-session");const flash = require("express-flash");const passport = require("passport");const initializePassport = require("../config/passportConfig");if (process.env !== "production") {    require("dotenv").config();}const PORT = process.env.PORT || 4000;const app = express();initializePassport(passport);app.set("view engine", "ejs");app.use(express.urlencoded({ extended: false }));app.use(    session({        secret: process.env.SESSION_SECRET,        resave: false,        saveUninitialized: false,    }));

Viewing all articles
Browse latest Browse all 6129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>