lukefx / hubot-telegram

Hubot adapter for Telegram
MIT License
160 stars 42 forks source link

Webhooks on Heroku 404 issues #40

Closed PatrickAuld closed 8 years ago

PatrickAuld commented 8 years ago

I've having trouble getting the TELEGRAM_WEBHOOK configured on Heroku. Everything I try gets 404's so I'm not sure where at app is actually listening. Here's what I'm seeing:

When TELEGRAM_WEBHOOK is set to https://<app>.herokuapp.com/ I see requets being made via the Heroku router but to / and not to /<token>/. This returns a 404.

2016-02-05T09:54:05.193209+00:00 heroku[router]: at=info method=POST path="/" host=teabee.herokuapp.com request_id=b0478df8-e6c2-4e4e-b0f8-e613c1098d8b fwd="149.154.167.198" dyno=web.1 connect=0ms service=5ms status=404 bytes=225

I've tried appending parts to the path, like /webhook/ and the webhook to Telegram is set to that still without the token. The Heroku logs are showing be debug statements so I'm missing the log line that prints where hubot is listening. I've also manually set the webhook within Telegram to include the token but without knowing where it is listening I'm not sure what value to set it to. So far I haven't had luck with it.

Several seconds after startup a HTTP 504 also appears within the logs. I'm not sure if this is related yet.

2016-02-05T10:07:26.371621+00:00 app[web.1]: [Fri Feb 05 2016 10:07:26 GMT+0000 (UTC)] ERROR Error: HTTP status 504 returned. 2016-02-05T10:07:26.371627+00:00 app[web.1]: at Request._callback (/app/node_modules/hubot-telegram/node_modules/telegrambot/lib/telegrambot.js:48:62) 2016-02-05T10:07:26.371628+00:00 app[web.1]: at Request.self.callback (/app/node_modules/hubot-telegram/node_modules/telegrambot/node_modules/request/request.js:199:22) 2016-02-05T10:07:26.371628+00:00 app[web.1]: at Request.emit (events.js:98:17) 2016-02-05T10:07:26.371629+00:00 app[web.1]: at Request. (/app/node_modules/hubot-telegram/node_modules/telegrambot/node_modules/request/request.js:1036:10) 2016-02-05T10:07:26.371630+00:00 app[web.1]: at Request.emit (events.js:117:20) 2016-02-05T10:07:26.371631+00:00 app[web.1]: at IncomingMessage.emit (events.js:117:20) 2016-02-05T10:07:26.371632+00:00 app[web.1]: at _stream_readable.js:944:16 2016-02-05T10:07:26.371633+00:00 app[web.1]: at process._tickCallback (node.js:448:13)

This is my first deployment on Heroku so I'm still getting ahold on how things work. The code (which is basically still the Yeoman example) is here.

arcturial commented 8 years ago

Hi

What version of the package are you using?

arcturial commented 8 years ago

I just release a new tag (0.1.0) that changes the way the webhook URL works. Sorry, the documentation on GitHub was for the master branch and the latest changes have yet to be tagged.

Your current version (assuming 0.0.10) should register the hook at:

https://[host]/hubot/telegram/receive

The latest version will work according to the documentation with the token in the URL:

https://[host]/[token]

PatrickAuld commented 8 years ago

That's my fault, I should have checked the docs for my release and not master. Thanks for pushing 0.1.0! I'll give it a go tonight.