I'm trying to run db-migrate
for postgres on heroku but cannot seem to figure out why it doesn't have the right env variables. Hoping for some guidance if someone else has encountered a similar problem.
I created a next.js app. Locally, I have a .env
file with DATABASE_URL
, etc. The app and migrations work just fine.
I pushed my app to heroku. The env variables are all defined in the heroku app config vars, so the app is working as expected. However, when I try to run db-migrate up
or down
, I get "Could not find database config file '/app/database.json'". I looked at the source and this only happens when process.env.DATABASE_URL
is not defined. However, it is in my heroku app config vars, so I am confused as to why the migration cannot find the database URL. I thought the config vars would be pushed into node's process.env.
I am working around this by creating a new .env
file in heroku every time I deploy but would prefer to fix this properly.