Could not load js config file config/database.js: Cannot read property ' charAt' of undefined

I had the same issue. In Heroku, I changed the Config Vars under Settings. The database string was saved under the name HEROKU_POSTGRESQL_PINK_URL on mine, so I needed to update that to match what was in the config, eg. process.env.DATABASE_URL.

Hope this helps.