sillygwailo / Slack-Twitter

Read your timeline, fave tweets, and post to Twitter from Slack.
48 stars 4 forks source link

App Constantly Crashes When Hosted by Heroku #14

Closed buck-0x closed 9 years ago

buck-0x commented 9 years ago

When I run the log I can see that npm start crashes almost immediately. Did you come across this?

sillygwailo commented 9 years ago

Can you paste what you see in the logs, @redthrawn? Do you have the Twitter and Slack tokens set?

buck-0x commented 9 years ago

I have the tokens set.

https://gist.github.com/redthrawn/178b1b73ed7afaa49509

In Heroku I just have the two default dynos: https://www.dropbox.com/s/b0iocablfubxx5f/Screenshot%202015-07-07%2021.40.17.png?dl=0

I don't really have any experience with node or web deployments so odds are I'm just doing something stupid.

sillygwailo commented 9 years ago

I just pushed a fix that should address this. Can you update and let me know?

buck-0x commented 9 years ago

I'm not sure if it's the same but it still doesn't work. Here is the log: https://gist.github.com/redthrawn/12ce51cccc5e1e723bff

buck-0x commented 9 years ago

I should just be able to run it locally by setting the environment vars and executing 'node slack-twitter.js' correct?

sillygwailo commented 9 years ago

Yes, you should be able to run it locally with environment variables set.

It looks like, at the very bottom of the log, that it's connecting. Do you see tweets in your Slack channel and/or are you able to post to Twitter?

buck-0x commented 9 years ago

Now it works when I run it locally, just not through Heroku.

$ heroku ps === node (Free): node slack-twitter.js node.1: idle 2015/07/07 21:57:59 (~ 29m ago)

=== web (Free): npm start web.1: crashed 2015/07/07 22:22:02 (~ 5m ago)

sillygwailo commented 9 years ago

@redthrawn It's up to date on Heroku? I committed a change to the package.json file that should start it properly.

buck-0x commented 9 years ago

OK it is working now. I directly linked GitHub with Heroku. For some reason it doesn't work when I manually clone the repo to my desktop and push with git and the Heroku command line tools. I had made the changes that you make to the JSON file. Not too sure what's up there but it is working now. Thanks a lot for your speedy help.

buck-0x commented 9 years ago

I spoke too soon. The problem is that it crashes after a timeout. https://gist.github.com/redthrawn/00bb15f1d5dd0a958b76

From the logs it looks like 60 seconds.

buck-0x commented 9 years ago

https://stackoverflow.com/questions/15693192/heroku-node-js-error-web-process-failed-to-bind-to-port-within-60-seconds-of

buck-0x commented 9 years ago

https://devcenter.heroku.com/articles/dynos#web-dynos

sillygwailo commented 9 years ago

Are you running it as a web dyno or a node dyno? There's no web component of it, so it should just be a node dyno.

buck-0x commented 9 years ago

That is defined in the Procfile right? I am running it as a node dyno.

sillygwailo commented 9 years ago

OK, I see what you mean. I get this: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch if I deploy using the button. Web dynos were initially deployed, despite my Procfile.

In the meantime, this should work, if you have the Heroku toolbelt installed:

heroku ps:scale web=0
heroku ps:scale node=1

You might need to do -a AppNameHere as well. You should be able to do that through the app's web management interface too.

sillygwailo commented 9 years ago

Let me know if that works. I might be out of luck with regards not so much turning off the 'web' dyno but setting how many 'node' workers are deployed clicking using the deploy button. http://stackoverflow.com/questions/28128018/can-i-set-the-number-of-worker-processes-in-app-json

buck-0x commented 9 years ago

OK got if figured out. After you added "start" to that file, I had to go back to Heroku and shut off the "start npm" dyno, which was on there by default.

Here is the live log, there is some sort of error but it doesn't seem to be a problem. https://gist.github.com/redthrawn/8df2d11df3a0fca2a9f3

Also the web page for the app says it doesn't work but it is.

Here is the build log: https://gist.github.com/redthrawn/bdc27f99e17668469298

buck-0x commented 9 years ago

Thank you so much for your help.