Answer the question
In order to leave comments, you need to log in
My telegram bot is crashing on Heroku. Who knows how to fix it?
Here are the logs:
2020-05-01T17:03:06.216123+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-01T17:08:01.589061+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=csguidesbot.herokuapp.com request_id=d9689bbd-f7a1-44ba-8434-2689514277ab fwd="5.34.73.29" dyno= connect= service= status=503 bytes= protocol=https
2020-05-01T17:08:02.330847+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=csguidesbot.herokuapp.com request_id=62de5dc1-7805-4f77-ae7d-f548e6e0e794 fwd="5.34.73.29" dyno= connect= service= status=503 bytes= protocol=https
2020-05-01T17:08:02.557764+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=csguidesbot.herokuapp.com request_id=c4c4f50a-be3b-45c5-8edb-36f5ce7dd4eb fwd="5.34.73.29" dyno= connect= service= status=503 bytes= protocol=https
const Telegram = require('node-telegram-bot-api');
const bot = new Telegram("Токен", {
polling: true
})
const API_PORT = process.env.PORT || 3000
console.log("Bot запущен")
web: node bot.js
{
"name": "cs_guides",
"version": "1.0.0",
"description": "",
"main": "bot.js",
"scripts": {
"start": "node bot.js",
"test": "echo "Error: no test specified" && exit 1"
},
"engines": {
"node": "12.16.3"
},
"author": "",
"license": "ISC",
"dependencies": {
"node-telegram-bot-api": "^0.40.0"
},
"devDependencies": {
"nodemon": "^2.0.3"
}
}
Answer the question
In order to leave comments, you need to log in
Heroku is famous for its unstable work with telegram bots. You are not the only one experiencing such difficulties. Many bots get stuck or fall asleep while working.
Possible solutions:
1) Restart the bot on exit. I can not give the code - I write it myself in another language.
2) Use a different hosting for the bot. I use paid. There are no problems with sticking the bot.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question