2

I'm trying to deploy my feathersjs web app on heroku, and since feathers is simply an express wrapper I thought it was like deploy an ordinary node app. I got the "npm start" script on my package.json, I added heroku remote to my git repo and when I push heroku run "yarn install" and the "npm start" script. But just when the app start, an error occurs: heroku logs

I can't figure out what happen, any suggestions? Maybe I could dockerize my app, someone could help me to find the proper implementation?

Thanks everybody

Dario Ielardi
  • 807
  • 9
  • 24

3 Answers3

2

It is the same as Express but the generated application will by default use feathers-configuration to pull in your application settings. From the error message it looks like you are not providing a proper NODE_ENV environment variable which has to be set to production when deploying to Heroku.

Daff
  • 43,734
  • 9
  • 106
  • 120
  • Hi Daff, thanks for your answer, but I still have the problem. I set the NODE_ENV env var to production in Heroku but when I deploy I see this: "WARNING: NODE_ENV value of 'production' did not match any deployment config file names" and the above error still occurs. – Dario Ielardi Nov 14 '17 at 08:29
  • Are you checking in an deploying the `config/` folder? – Daff Nov 14 '17 at 17:57
  • it's embarassing, I had gitignored the config folder. sorry for wasting your time. – Dario Ielardi Nov 14 '17 at 20:16
  • @Daff shouldn't config direct be ignored? Atleast the production config should be. – abhisekp Apr 19 '18 at 10:53
1

Working port of feathers-chat app to Heroku PostgreSQL via Sequelize

I got a port of the hello world https://github.com/feathersjs/feathers-chat running on Heroku right now!

Key source changes

Set 'postgres' to the DATABASE_URL environment variable config/production.json:

+  "postgres": "DATABASE_URL"

Heroku also exports PORT which was also already in that file before my patch.

Pass dialiectOptions to the DB connection as per: Can't connect to heroku postgresql database from local node app with sequelize

+  const sequelize = new Sequelize(connectionString, {
+    dialect: 'postgres',
+    logging: false,
+    define: {
+      freezeTableName: true
+    },
+    dialectOptions: {
+      // https://stackoverflow.com/questions/27687546/cant-connect-to-heroku-postgresql-database-from-local-node-app-with-sequelize
+      // https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js
+      // https://stackoverflow.com/questions/58965011/sequelizeconnectionerror-self-signed-certificate
+      ssl: {
+        require: true,
+        rejectUnauthorized: false
+      }
+    }
+  });

Key Heroku settings

  • enable the PostgreSQL Heroku add-on with:

    heroku addons:create heroku-postgresql:hobby-dev-
    

    This automatically sets the DATABASE_URL environment variable for us.

  • in config/production.json edit host to your correct value

  • in the Heroku app Settings, set the NODE_ENV environment variable to production

Bibliography:

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
0

try set "NODE_CONFIG_DIR" to "app/config/"

wu-sama
  • 251
  • 2
  • 7
  • just for myself in the future, this worked for me by setting app.js: process.env["NODE_CONFIG_DIR"] = path.join(__dirname, "../config/"); – Jan Dec 19 '19 at 16:13