Open
Description
Sometimes in dev, build fails with backend error Error: You must provide the domain configuration value to use passport-auth0.
I think this is because passport-auth0
gets imported before process.env
is populated.
A global search of the entire source code shows that dotenv
isn't being imported anywhere except in /dev-tools/babel-run-with-env
and /dev-tools/jest.transform.js
, neither of which is used in the normal npm run dev
scenario. Unless there's env magic happening somewhere else I'm not aware of, this seems like the problem.
I propose adding this to the very top of /src/server/index.js
:
if (['development', 'test'].includes(process.env.NODE_ENV)) {
// eslint-disable-next-line global-require
require('dotenv').config() // configure env vars in dev and test environments
}
The problem hasn't recurred since I tried this locally.