New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad webhook error on start up #3
Comments
So, digging a bit deeper, it tries to register a webhook with Telegram and for the port it uses I ran bash on the console of my dyno and ...but after doing that I found a question on StackOverflow that suggests this is not an uncommon issue and that Heroku maps external ports 80 and 443 to an internal port we can't control but I can't quite figure out how to translate that knowledge into a fix for this problem...? Edit: It doesn't look like it in the screenshot but the other Config Vars are set correctly... I redacted them but I probably should have put a black block over the top rather than deleting those sections and leaving a transparent gap 🙂 |
Hey! You don’t need to specify PORT env - Heroku should be able to specify any port it needs. The problem is another Take a look at the first line of the logs you’ve sent: you just have not setup all env variables. Especially HEROKU_APP_NAME. You also need to specify other variables too and not leave them empty. |
Thanks for your response but I have double checked those other settings (see explanation below). I'm fairly sure the port is the problem in my case. Sorry for the confusion with the screenshot BTW. When I redacted it in Preview it looked like this: ...but then the deleted sections just turned white in GutHub. I tried to pre-emptively address it once the post saved - see the "Edit" at the bottom of my comment - but obviously I should have changed the image :) |
I just pushed a new build with PORT hardcoded to 443 (changed
|
The point Is this I just successfully deployed the bot using that button without any change in the source code of the project. So I have not reproduced your issue yet. I'd suggest to roll back to the original code without any port change and to try to deploy again with all .env vars provided. |
Take a look at the first line of your logs:
You need to have a valid url printed here. See this line: https://github.com/ohld/telegram-support-bot/blob/main/main.py#L21 |
Probably it is the problem with python-telegram-bot library - they changed the logic behind the webhook support. Let's try to use the older version of the library. |
Вот такая штука сработала (по мотивам https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks#heroku)
|
YES! It worked. Thanks, @stikhonchuk. Final commit: ab9638e |
I just deployed this to Heroku and I think I got everything right but I'm getting an error when the app tries to start...
telegram.error.BadRequest: Bad webhook
I've checked the URL as per the first line of output but there's not many other clues... it's running on a free dyno if that makes a difference?
The text was updated successfully, but these errors were encountered: