Answer the question
In order to leave comments, you need to log in
Why does the bot crash after launch after about 1 minute?
Hello, I decided to play with bots in Telegram at my leisure.
I made a simple one from the lessons, everything works fine on the local, but when deployed to Heroku, it stops working after about a minute. Log:
2021-10-27T13:20:53.523824+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-10-27T13:20:53.973649+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-10-27T13:20:54.119848+00:00 heroku[web.1]: Process exited with status 137
2021-10-27T13:20:54.177180+00:00 heroku[web.1]: State changed from starting to crashed
web: node index.js -p $PORT
const TelegramApi = require('node-telegram-bot-api')
const token = 'ТОКЕН';
const bot = new TelegramApi(token, { polling: true })
bot.on('message', msg => {
console.log(msg)
const chatId = msg.chat.id;
const text = msg.text;
bot.sendMessage(chatId, 'Вы написали ' + text)
if (text == '/start') {
bot.sendMessage(chatId, "Hi, I'll text you when someone visits the site.")
}
})
Answer the question
In order to leave comments, you need to log in
Try
worker: node index.js -p $PORT
https://devcenter.heroku.com/articles/background-j...
It also crashes in this mode, but it seems to restart itself
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question