Reputation: 825
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
Upvotes: 2
Views: 1951
Reputation: 383090
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:
Upvotes: 1
Reputation: 44215
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.
Upvotes: 2