marklagendijk/node-toogoodtogo-watcher

Can't sendMessage to Telegram using heroku

Closed this issue · 6 comments

2021-03-27T18:51:47.412662+00:00 app[worker.1]: /app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/util/hostReportError.js:4
2021-03-27T18:51:47.412663+00:00 app[worker.1]: setTimeout(function () { throw err; }, 0);

TypeError: Cannot read property 'telegram' of null
2021-03-27T18:51:47.412665+00:00 app[worker.1]: at sendMessage (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/telegram-bot.js:65:14)
2021-03-27T18:51:47.412665+00:00 app[worker.1]: at /app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/telegram-bot.js:61:30
2021-03-27T18:51:47.412666+00:00 app[worker.1]: at arrayEach (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/lodash/lodash.js:530:11)
2021-03-27T18:51:47.412666+00:00 app[worker.1]: at Function.forEach (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/lodash/lodash.js:9410:14)
2021-03-27T18:51:47.412667+00:00 app[worker.1]: at Object.notify (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/telegram-bot.js:61:5)
2021-03-27T18:51:47.412667+00:00 app[worker.1]: at Object.notifyIfChanged (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/notifier.js:41:19)
2021-03-27T18:51:47.412667+00:00 app[worker.1]: at SafeSubscriber._next (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/index.js:41:32)
2021-03-27T18:51:47.412668+00:00 app[worker.1]: at SafeSubscriber.__tryOrUnsub (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/Subscriber.js:205:16)
2021-03-27T18:51:47.412669+00:00 app[worker.1]: at SafeSubscriber.next (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/Subscriber.js:143:22)
2021-03-27T18:51:47.412669+00:00 app[worker.1]: at Subscriber._next (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/Subscriber.js:89:26)

So you need to delete away your project. instead you install the project folder somewhere else without the node modules folder inside it. push only the project's files. then heroku will do the package installing. this helped me. its also smart to upload the config already filled out with an session id.

Got a similar error, will let you know if something helps:


/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/util/hostReportError.js:4
    setTimeout(function () { throw err; }, 0);
                             ^

TypeError: Cannot read property 'telegram' of null
    at sendMessage (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/telegram-bot.js:65:14)
    at /app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/telegram-bot.js:61:30
    at arrayEach (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/lodash/lodash.js:530:11)
    at Function.forEach (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/lodash/lodash.js:9410:14)
    at Object.notify (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/telegram-bot.js:61:5)
    at Object.notifyIfChanged (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/lib/notifier.js:41:19)
    at SafeSubscriber._next (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/index.js:41:32)
    at SafeSubscriber.__tryOrUnsub (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.next (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/Subscriber.js:143:22)
    at Subscriber._next (/app/.heroku/node/lib/node_modules/toogoodtogo-watcher/node_modules/rxjs/internal/Subscriber.js:89:26) ```

Hi, Same issue here:
Telegram message are not sending, but what's really strange, is that is I log into heroku run bash and exec node index.js watch it's working.

But with the free dynos as a worker, it doesnt seems to work.

Any idea ?

This error indicates a configuration issue. Be sure to put the whole config JSON in the environment variable:

From your terminal, run heroku config:set TOOGOODTOGO_CONFIG=content, replacing content with the content of your config.json file.

Can someone who has experience with this pleas write more detailed instructions?
You can post them here, or create a PR for changing the README.

Im not using heroku anymore. i did copy the whole config