Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

205
Vistas
Node JS -Telegram bot works locally but not on heroku

My telegram bot working perfectly on local machine but when I deploy it to heroku it become unresponsive and dynos are also set to npm start even when I declared start script in package.json.Here is the log file:-

2022-06-04T15:45:02.232005+00:00 app[web.1]: at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:547:31) 2022-06-04T15:45:02.232006+00:00 app[web.1]: at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:604:18) 2022-06-04T15:45:02.232006+00:00 app[web.1]: at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:649:10) 2022-06-04T15:45:02.232006+00:00 app[web.1]: at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:729:18) 2022-06-04T15:45:02.232006+00:00 app[web.1]: at _drainQueueStep (/app/node_modules/bluebird/js/release/async.js:93:12) 2022-06-04T15:45:02.232007+00:00 app[web.1]: at _drainQueue (/app/node_modules/bluebird/js/release/async.js:86:9) 2022-06-04T15:45:02.232007+00:00 app[web.1]: at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:102:5) 2022-06-04T15:45:02.232008+00:00 app[web.1]: at Immediate.Async.drainQueues [as _onImmediate] (/app/node_modules/bluebird/js/release/async.js:15:14) 2022-06-04T15:45:02.232011+00:00 app[web.1]: at processImmediate (node:internal/timers:466:21) 2022-06-04T15:45:02.521059+00:00 heroku[web.1]: State changed from starting to up

edit- The code is shared below, I followed a tutorial to make my own telegram bot

    const TelegramBot = require('node-telegram-bot-api');
    const axios = require('axios');
    // This file would be created soon
    
     
    require('dotenv').config();
     
    const token = "token is here";
    let bot;
     
    if (process.env.NODE_ENV === 'production') {
       bot = new TelegramBot(token);
       bot.setWebHook(process.env.HEROKU_URL + bot.token);
    } else {
       bot = new TelegramBot(token, { polling: true });
    }
    
    bot.onText(/\/word (.+)/, (msg, match) => {
        const chatId = msg.chat.id;
        const word = match[1];
        bot.sendMessage(chatId, "NO");
      });
    
      const express = require('express')
    const bodyParser = require('body-parser');
     
    const app = express();
             
    app.use(bodyParser.json());
     
    app.listen(process.env.PORT);

    app.post('/' + bot.token, (req, res) => {
      bot.processUpdate(req.body);
      res.sendStatus(200);
    });
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda