node-express-realworld-example-app
node-express-realworld-example-app copied to clipboard
Deployment on Heroku did not work
I deployed from both windows and mac, all seemed to work fine, but when i open the app from Heroku, it says Application error
Also 'heroku addons:create mongolabs:sandbox' should be mongolab (without s)
can someone help us find a solution for this ?
anyone here? Please help!
i got this working by seeing heroku logs and fixing them
can you share more info? What did you do to fix it?
open the heroku link then type
heroku logs
read the error find them in code and fix them
for me errors was es6 syntax problem
Thanks, the error i saw on the logs is "Secret should be set",
in index.js, if i change this line: secret: process.env.NODE_ENV === 'production' ? process.env.SECRET : 'secret' to: secret: process.env.NODE_ENV === 'production' ? 'secretforproduct' : 'secret'
Then it works, but that is not good for production.
It looks like it can get process.env.SECRET?
Hey, i think you should change the 'secret' not process.env.SECRET
I had the same error. I created a Heroku environment variable SECRET and set it to whatever I wanted the secret to be.
heroku config:set SECRET=canbeanythingyouwant
then test in Postman, it works
You need to set(CREATE) the environment variable in heroku "SECRET" to secret.
You can do this via heroku settings or using heroku config command
thanks guys
I am trying to deploy to heroku, But I am having problem... Has anyone completed deploying heroku?
@wilfredonoyola I just deployed to heroku successfully. I had to update the SECRET variable as mentioned above by a few people. I ran "heroku config:set SECRET=canbeanythingyouwant" and worked perfectly after the change
Here's a working backend + frontend deployment of this repo with mongodb ported to sequelize postgresql: https://github.com/cirosantilli/node-express-sequelize-realworld-example-app
Source at: https://github.com/cirosantilli/node-express-sqeuelize-realworld-example-app/tree/7b208085f88375291e2dabcab74229e703cb8769 which is a small fork of https://github.com/sigoden/node-express-realworld-example-app that did the port.
What I've found is sometimes a .env
secret stored like this locally:
TEST_SECRET=k&2jd!Dj$
will read as a different value when put into Heroku's env boxes like this:
Left box: TEST_SECRET
, Right box: k&2jd!Dj$
.
What worked for me? Adding quotes around the Heroku env right textbox like so:
Left box: TEST_SECRET
, Right box: "k&2jd!Dj$"
.