Heroku incompatibility
See original GitHub issue- Telegraf.js Version: latest (3.29.0)
- Node.js Version: 10.8.0
- Operating System: win 8.1 64b (but deployed on Heroku)
The following code snippet misbehaves.
amountScene.hears(/^\s*(\d+)\s*$/, async ctx=>{
console.log(ctx.message);
await ctx.telegram.deleteMessage(ctx.message.chat.id, ctx.message.message_id)
console.log('woooosh')
if (ctx.match[1]>=ctx.session.service[0].MinOrder){
ctx.session.amount = ctx.match[1]
ctx.scene.enter('service')
} else {
tempMessage(ctx, resp.failedAmount(ctx.session.lang))
}
})
This handler is supposed to receive a text message like " 120", delete it, and if it complies with certain parameters, return to the previous scene while setting the session.amount
to the received value.
Instead this code freezes the handler and it does not execute console.log('woooosh')
or anything past it.
ctx.message
always has the correct contents and gets output every time.
Removing await
from ctx.telegram.deleteMessage()
fixes the freeze, but the message still does not get deleted.
However, if I restart the app right before this handler gets used, the app deletes the message just fine. So like… it only deletes a message once every session.
I am using telegraf-session-mysql
btw, but I don’t see how that’s relevant to ctx.telegram
working in a weird way.
With long polling from local machine everything works smoothly, despite a huge latency instilled by my VPN setup.
Using bot.launch
method as well as the old way does not make a difference.
Requesting support.
PS: This one-time “pool” seems to be shared between different telegram functions. For example ctx.answerCbQuery("hai bishh", true)
also does not get executed except for the first time. And executing it also prevents deleteMessage()
from working properly. But all my editMessageMedia
calls do work, interestingly enough. Or sendPhoto
. So it’s a very localized problem.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Also to note, the following block of code faces the same complications as the aforementioned ones.
It works first time, but after that it requires a
heroku restart
to work again. What.Even.Guys, please don’t forget to call all Telegraf function asynchronously: