Reputation: 1461
I'm getting a frustrating "error" while trying to run a simple Node.js app on Heroku. Heroku itself is not reporting an error - the app is up (not crashed, no "Hxx" codes being shown); what I get is this:
heroku[router]: at=info method=GET path=/index.html
host=realsheek.herokuapp.com fwd="24.63.82.165" dyno=web.1 connect=0ms
service=4ms status=404 bytes=33
When i run the app from the browser, it says Cannot GET
. I don't know what it's trying to GET
. My app is a test bed for a SocialProvider using Mozilla's SocialAPIs. The app itself is a version of the demo from https://github.com/mixedpuppy/socialapi-demo
. A couple of bugs were fixed, else this is identical to this demo (i used the repo as is with just the bugs fixed). I have an index.html
page which installs the SocialProvider, at which time the server-side app kicks in and does the rest of the magic. It runs fine on localhost
, but when I push it up to Heroku, it fails. There were no problems reported with the git push
(just the usual "no readme data" warnings).
I am stumped as I just can't see what it's trying to GET; obviously a 404 error suggests a missing page, but the app makes no calls to any HTML
pages, and everything that's needed is present (as my run on localhost
confirms).
I realize that this isn't a lot to go on, not seeing the actual app and not knowing what it's trying to do. And with no actual error to report - just a 404 status, it obviously could be anything. But I am stumped currently, so if anyone has any insight or suggestion, I'd be most grateful.
Upvotes: 2
Views: 9275
Reputation: 1812
Hi i too got frustrate a lot while deploying the app. in order to deploy you need to make sure about two things.
1) Set the port using environment variable var port=Number(process.env.PORT || 3000);
2) dont forget to include Procfile as web: node app.js(Your start file)
Upvotes: 9
Reputation: 1421
I had a similar problem. The solution was as simple as:
1) Make sure to have a Procfile correctly written. It should look like:
web: node index.js
2) After pushing the code to heroku, try to run the following command:
heroku ps:scale web=1
Hope that helps!
Upvotes: 0
Reputation: 171
That demo isn't a node app, or atleast isn't packaged the way heroku likes it with a Procfile and everything. If you have a node app, then it would server the static files as per it's code (or atleast it should), but heroku isn't a standard web server for static pages (like Apache or nginx or whatever). Heroku was built to run web apps, which are essentially their own servers.
If you get a node server running, this heroku quickstart for node should help you out. https://devcenter.heroku.com/articles/nodejs
Upvotes: 0