Closed itranga closed 8 years ago
Hello, @itranga.
Did you change the MONGOHQ_URL to MONGOLAB? https://github.com/ericmdantas/generator-ng-fullstack/blob/master/app/templates/server_node/config/db.conf.js#L8
Yes . I have change it in db.json file .
"localhost": "mongodb://username:pwd@ds031952.mlab.com:31952/temple"
My local app is working fine .I have issue only in heroku server.I think it have some issue in api url .
What's the content of your procfile.txt
?
Change it to:
web: npm start
I have allready done . procfile = web: npm start
Same error?
If so, is the deploy to heroku ok or there are some errors? Also, can you connect to the DB outside of the application?
I got the same error . I connected MONGO Db from https://mlab.com/ . I think issue is in router . Because I try to view https://mytemple.herokuapp.com/api/todos/. it's not working .But my local pc app router is working [ http://localhost:3333/api/todos ]
Can you show some logs/prints?
Online
https://mytemple.herokuapp.com/api/todos/
Chrome Print
Application Error An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
Offline
http://localhost:3333/api/todos/
Chrome Print
[{"_id":"56f49f682f31c84360a6c018","todoMessage":"test","v":0,"createdAt":"2016-03-25T02:16:08.587Z"},{"_id":"56f4a399a1bfc50d6435f672","todoMessage":"test2","__v":0,"createdAt":"2016-03-25T02:34:01.606Z"},{"_id":"56f4e8a2d14e76e01d4220bc","todoMessage":"ssdsd","v":0,"createdAt":"2016-03-25T07:28:34.074Z"},{"_id":"56f77003d256cfdb04d6be26","todoMessage":"ranga","__v":0,"createdAt":"2016-03-27T05:30:43.903Z"}]
I see, the page is showing, but there's no interaction with the server.
The thing I'm noticing is the request is taking forever to resolve. For example, the GET
on api/todos
took 1min
and then got the 503 Service Unavailable
error.
Are you using express
to serve the index.html
or some static server? If you're not using express, make sure your proxy is set up correctly.
I used your generator-ng-fullstack code .change only db.json file .
You'll also have to change the enviroment variable for the Mongo connection.
By default, the generator uses MONGOHQ_URL
to connect to the database. You'll have to use MONGOLAB_URI
. That config is in server/config/db.config.js
.
I have change MONGOHQ_URL to MONGOLAB_URI . Did u try to host your code heroku servers ?
Yes - it's been a while, though.
Let me give it a try with a newer version.
Alright, got it to work with mongolab: https://issue-97.herokuapp.com/
What I had to do:
production
;server/config/db.conf.js
, change from MONGOHQ_URL
to MONGOLAB_URI
.The rest is just the default Heroku deploy steps.
Thank you so much for all you have done for me . I will follow your process
Thanks for sticking by, and providing some feedback on how to reproduce it :smile:
By the way, I created an explanation in the wiki to help other people that might run into similar problems: https://github.com/ericmdantas/generator-ng-fullstack/wiki/Deploying-to-Heroku
it's working now . I changed const URL = dbConst.localhost; in db.conf.ts . (Because Need to add Credit card to create mLab MongoDB in heroku )
I want again to thanks you for help and support
Awesome! :+1:
I hosted sample app in https://mytemple.herokuapp.com/ . I got following issue in console .
https://mytemple.herokuapp.com/api/todos/ 503 (Service Unavailable).
I connected mongodb in mongolab