Skip to content

passport-auth0 sometimes breaks the build #753

Open
@harpojaeger

Description

@harpojaeger

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-initial install/setupArea: Ease of installation of a development environmentA-server-side (nodejs)Area: All changes on the server sideC-bugType: BugS-needs confirmationStatus: Need to check if this is still an issue and can be reproduced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions