Problem with mdidlewares on webhooks #2230
Unanswered
archibald1418
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello dear telebot team and thank you for your client library
I was just fiddling with middlewares when I found out that I had problems setting up middlewares
wsgi: fastapi (without async and with bot set to threaded=False)
tunnelling: ngrok
The error is:
The ports match, bot token is valid, ngrok tunnel is secure, the curl request for setWebhook returns 200 OK.
Without middlewares, bot commands work perfectly fine
Function middlewares work ok only if I use infinite_polling on my bot
I also tried using class middlewares, but using them with webhooks yielded some nasty event loop errors (even though the wsgi app and the bot appeared to work synchronously)
I've also tried switching wsgi to Flask, thinking it was something wrong with async operations, but I only encountered different errors regarding the setWebhook method. For illustrative purposes, I decided to use session.py example from the repo, adding the Flask code to it to check the functioning of the middlewares
It gave 'Too many requests to Telegram API' error, although a simple curl request to the setWebhook endpoint with same parameters was working fine (supposedly some unsanctioned retry loop working behind the scenes of apihelper). Also, with Flask I encountered lots of 422 Unprocessable Entity errors
Has somebody encountered this?
Beta Was this translation helpful? Give feedback.
All reactions