Strapi 4 on heruku

System Information
  • Strapi Version: 4.00
  • Operating System: Windows 10
  • Database: mysql
  • Node Version: v14.18.2
  • NPM Version: 6.14.15
  • Yarn Version: 1.22.17

I have install Strapi 4 on localhost by --quickstart flag. I have deployed it on Heroku by following this guide https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/heroku.html

But it seems Strapi runs by local database not ./config/env/production/database.js
I have environment variable NODE_ENV=production in Heroku.

Have you set enviromental variables on heroku for

4. Create your Heroku database config file for production

Yes, I did

What variables did you set in heroku if I can ask ?

This are the config variable

  • NODE_ENV
  • MY_HEROKU_URL
  • DATABASE_USERNAME
  • DATABASE_PASSWORD
  • DATABASE_NAME
  • DATABASE_HOST

You need the DATABASE_URL

DATABASE_HOST and DATABASE_URL aren’t same ? What should the value of DATABASE_URL ?

DATABASE_URL is the postgres database or addon that should be set if you setup a database in heroku.
If you have added a postgres database to heroku it should be done by itself

1 Like

DATABASE_URL is a combination of the protocol + user + password @ host + port / dbname

Usually looks something like postgres://username:password@host:port/dbname?someExtraParams

2 Likes

Thank you for your time guys. Actually I was using AWS RDS for database and I forgot to create a database there. Everything was fine in config variable