Skip to content

environment variables undefined #50

Open
@matthewboman

Description

@matthewboman

When I try to start the site (~p. 248), I'm met with the following error:

Unhandled rejection SequelizeConnectionError: password authentication failed for user "crash"

which caught me off guard because my .env file is:

DATABASE=gql
DATABASE_USER=postgres
DATABASE_PASSWORD=postgres

After going down the rabbit hole with Postgres and permissions and still not solving the issue I tried logging my environment variables only to find them undefined. (Really, that should have been the first place I checked).

I was able to fix the issue by updating /models/index.js and adding:

import 'dotenv/config';

I see it also exists in /src/index.js in the repo, but the book never specifies adding it anywhere. Updating the code for the index on p. 243 would save the reader a lot of troubleshooting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions