My variables defined in .env were not read. The solution I found was using the npm package dotenv.
To fix this:
I added the statement below at the beginning of app.js to load the variables in .env
require('dotenv').load();
I added the dependency into package.json (or install with npm install --save dotenv).
"dotenv": "^1.2.0"