dipu-bd / lightnovel-crawler

Generate and download e-books from online sources.
https://pypi.org/project/lightnovel-crawler/
GNU General Public License v3.0
1.37k stars 267 forks source link

Heroku Deploying Logs Error #664

Closed X-Gorn closed 3 years ago

X-Gorn commented 3 years ago

Heroku Config:

2020-11-06T03:25:50.830315+00:00 app[bot.1]: 2020-11-06 03:25:50,830 [ERROR] (telegram.ext.updater) 2020-11-06T03:25:50.830385+00:00 app[bot.1]: Error while getting Updates: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running 2020-11-06T03:25:50.830911+00:00 app[bot.1]: 2020-11-06 03:25:50,830 [ERROR] (telegram.ext.dispatcher) 2020-11-06T03:25:50.830955+00:00 app[bot.1]: An uncaught error was raised while handling the error. 2020-11-06T03:25:50.830956+00:00 app[bot.1]: Traceback (most recent call last): 2020-11-06T03:25:50.830956+00:00 app[bot.1]: File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 411, in process_update 2020-11-06T03:25:50.830957+00:00 app[bot.1]: self.dispatch_error(None, update) 2020-11-06T03:25:50.830957+00:00 app[bot.1]: File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 638, in dispatch_error 2020-11-06T03:25:50.830957+00:00 app[bot.1]: callback(update, context) 2020-11-06T03:25:50.830976+00:00 app[bot.1]: TypeError: error_handler() missing 1 required positional argument: 'error'

dipu-bd commented 3 years ago

@NNTin can you check this out?

NNTin commented 3 years ago

@X-Gorn Provide reproduction steps. How do you have your environment variables set up and what were you doing leading to that command? E.g. when you were using the discord bot which exact commands did you run?

@dipu-bd "Error while getting Updates: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running" Is this error known to you?

I haven't played with the Telegram API. I will have to look into how to get a Telegram instance running myself. To me it looks like he was running two bot instances on the Telegram API.

dipu-bd commented 3 years ago

@NNTin Yes, he was running two instances I guess.

I have modified requirements and app code since your last update of heroku. I don't know if something is broken there. I don't have much experience with heroku.

NNTin commented 3 years ago

When I'm home (~9 hours, my work day just started) I will take a look if the deployment still works.

NNTin commented 3 years ago

I'm so confused. The Discord bot does not come online but the log says it came online. I made sure I invited the correct bot to the server and I checked the bot token. I will investigate Sunday...

dipu-bd commented 3 years ago

@NNTin have to set the shard properties? There are two new options: --shard-count --shard-id. You have to set them first to make discord bot online.

an example:

$ python __main__.py --bot discord --shard-id 0 --shard-count 1
NNTin commented 3 years ago

--shard-id 0 --shard-count 1 needs to be added to Procfile for Discord bot to work.

Procile content: bot: python . --shard-id 0 --shard-count 1

Discord bot comes online. Available exports: epub text web mobi pdf fb2

When exporting a chapter as web format following error pops up:

2020-11-07T18:27:16.599970+00:00 app[bot.1]: Traceback (most recent call last):
2020-11-07T18:27:16.599971+00:00 app[bot.1]:   File "runpy.py", line 194, in _run_module_as_main
2020-11-07T18:27:16.599971+00:00 app[bot.1]:   File "runpy.py", line 87, in _run_code
2020-11-07T18:27:16.599971+00:00 app[bot.1]:   File "site.py", line 45, in <module>
2020-11-07T18:27:16.599972+00:00 app[bot.1]:   File "site.py", line 41, in main
2020-11-07T18:27:16.599972+00:00 app[bot.1]:   File "calibre/ebooks/conversion/cli.py", line 401, in main
2020-11-07T18:27:16.599973+00:00 app[bot.1]:   File "calibre/ebooks/conversion/plumber.py", line 1106, in run
2020-11-07T18:27:16.599974+00:00 app[bot.1]:   File "calibre/ebooks/conversion/plugins/pdf_output.py", line 151, in specialize_options
2020-11-07T18:27:16.599974+00:00 app[bot.1]:   File "bypy-importer.py", line 78, in create_module
2020-11-07T18:27:16.599975+00:00 app[bot.1]: ImportError: libnss3.so: cannot open shared object file: No such file or directory

A*_web.zip is however still uploaded and the html website is working. Does this error needs to be fixed?


Telegram bot has following problem on any message:

2020-11-07T18:48:01.231316+00:00 heroku[bot.1]: Starting process with command `python .`
2020-11-07T18:48:02.056464+00:00 heroku[bot.1]: State changed from starting to up
2020-11-07T18:48:05.204129+00:00 app[bot.1]: ================================================================================
2020-11-07T18:48:05.204278+00:00 app[bot.1]:                            📒 Lightnovel Crawler 🍀2.23.3 
2020-11-07T18:48:05.204435+00:00 app[bot.1]:                   https://github.com/dipu-bd/lightnovel-crawler 
2020-11-07T18:48:05.204504+00:00 app[bot.1]: --------------------------------------------------------------------------------
2020-11-07T18:48:05.206807+00:00 app[bot.1]:                            🔊 LOG LEVEL: INFO
2020-11-07T18:48:05.206877+00:00 app[bot.1]: --------------------------------------------------------------------------------
2020-11-07T18:48:05.316243+00:00 app[bot.1]: 
2020-11-07T18:48:05.317378+00:00 app[bot.1]: ➡ Press  Ctrl + C  to exit
2020-11-07T18:48:05.317419+00:00 app[bot.1]: 
2020-11-07T18:48:06.248352+00:00 app[bot.1]: 2020-11-07 18:48:06,248 [INFO] (lncrawl.utils.racovimge)
2020-11-07T18:48:06.248384+00:00 app[bot.1]: Jinja2 is required for cover generation:
2020-11-07T18:48:06.248389+00:00 app[bot.1]:     pip install Jinja2
2020-11-07T18:48:06.250632+00:00 app[bot.1]: 2020-11-07 18:48:06,250 [INFO] (lncrawl.core.downloader)
2020-11-07T18:48:06.250663+00:00 app[bot.1]: CairoSVG was not found.Install it to generate random cover image:
2020-11-07T18:48:06.250692+00:00 app[bot.1]:     pip install cairosvg
2020-11-07T18:48:06.550418+00:00 app[bot.1]: 2020-11-07 18:48:06,550 [INFO] (apscheduler.scheduler)
2020-11-07T18:48:06.550480+00:00 app[bot.1]: Scheduler started
2020-11-07T18:48:07.046771+00:00 app[bot.1]: Telegram bot is online!
2020-11-07T18:48:08.179351+00:00 app[bot.1]: 2020-11-07 18:48:08,176 [ERROR] (telegram.ext.dispatcher)
2020-11-07T18:48:08.179448+00:00 app[bot.1]: An uncaught error was raised while handling the error.
2020-11-07T18:48:08.179449+00:00 app[bot.1]: Traceback (most recent call last):
2020-11-07T18:48:08.179450+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 425, in process_update
2020-11-07T18:48:08.179451+00:00 app[bot.1]:     handler.handle_update(update, self, check, context)
2020-11-07T18:48:08.179451+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/conversationhandler.py", line 487, in handle_update
2020-11-07T18:48:08.179452+00:00 app[bot.1]:     new_state = handler.handle_update(update, dispatcher, check_result, context)
2020-11-07T18:48:08.179453+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/handler.py", line 145, in handle_update
2020-11-07T18:48:08.179453+00:00 app[bot.1]:     return self.callback(update, context)
2020-11-07T18:48:08.179454+00:00 app[bot.1]: TypeError: handle_novel_url() missing 1 required positional argument: 'user_data'
2020-11-07T18:48:08.179454+00:00 app[bot.1]: 
2020-11-07T18:48:08.179455+00:00 app[bot.1]: During handling of the above exception, another exception occurred:
2020-11-07T18:48:08.179455+00:00 app[bot.1]: 
2020-11-07T18:48:08.179455+00:00 app[bot.1]: Traceback (most recent call last):
2020-11-07T18:48:08.179456+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 441, in process_update
2020-11-07T18:48:08.179456+00:00 app[bot.1]:     self.dispatch_error(update, e)
2020-11-07T18:48:08.179456+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 638, in dispatch_error
2020-11-07T18:48:08.179457+00:00 app[bot.1]:     callback(update, context)
2020-11-07T18:48:08.179494+00:00 app[bot.1]: TypeError: error_handler() missing 1 required positional argument: 'error'
2020-11-07T18:48:12.040124+00:00 app[bot.1]: 2020-11-07 18:48:12,039 [ERROR] (telegram.ext.dispatcher)
2020-11-07T18:48:12.040264+00:00 app[bot.1]: An uncaught error was raised while handling the error.
2020-11-07T18:48:12.040267+00:00 app[bot.1]: Traceback (most recent call last):
2020-11-07T18:48:12.040268+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 425, in process_update
2020-11-07T18:48:12.040268+00:00 app[bot.1]:     handler.handle_update(update, self, check, context)
2020-11-07T18:48:12.040269+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/conversationhandler.py", line 487, in handle_update
2020-11-07T18:48:12.040270+00:00 app[bot.1]:     new_state = handler.handle_update(update, dispatcher, check_result, context)
2020-11-07T18:48:12.040271+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/handler.py", line 145, in handle_update
2020-11-07T18:48:12.040271+00:00 app[bot.1]:     return self.callback(update, context)
2020-11-07T18:48:12.040272+00:00 app[bot.1]: TypeError: init_app() missing 1 required positional argument: 'user_data'
2020-11-07T18:48:12.040273+00:00 app[bot.1]: 
2020-11-07T18:48:12.040274+00:00 app[bot.1]: During handling of the above exception, another exception occurred:
2020-11-07T18:48:12.040274+00:00 app[bot.1]: 
2020-11-07T18:48:12.040274+00:00 app[bot.1]: Traceback (most recent call last):
2020-11-07T18:48:12.040275+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 441, in process_update
2020-11-07T18:48:12.040275+00:00 app[bot.1]:     self.dispatch_error(update, e)
2020-11-07T18:48:12.040275+00:00 app[bot.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 638, in dispatch_error
2020-11-07T18:48:12.040276+00:00 app[bot.1]:     callback(update, context)
2020-11-07T18:48:12.040310+00:00 app[bot.1]: TypeError: error_handler() missing 1 required positional argument: 'error'

got similar error as @X-Gorn but I'm not running the same Telegram instance multiple times.

Similar error persists when I run it on a VPS (Ubuntu 18.04 x64):

(venv) root@TinVultr:~/projects/lightnovel-crawler# TELEGRAM_TOKEN=123:ABCabc BOT=telegram python __main__.py --shard-id 0 --shard-count 1  
CRITICAL:root:Failed to import `ebooklib`
================================================================================
                           📒 Lightnovel Crawler 🍀2.23.3
                  https://github.com/dipu-bd/lightnovel-crawler
--------------------------------------------------------------------------------

➡ Press  Ctrl + C  to exit

Telegram bot is online!
ERROR:telegram.ext.dispatcher:An uncaught error was raised while handling the error.
Traceback (most recent call last):
  File "/root/projects/lightnovel-crawler/venv/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 425, in process_update
    handler.handle_update(update, self, check, context)
  File "/root/projects/lightnovel-crawler/venv/lib/python3.6/site-packages/telegram/ext/conversationhandler.py", line 487, in handle_update
    new_state = handler.handle_update(update, dispatcher, check_result, context)
  File "/root/projects/lightnovel-crawler/venv/lib/python3.6/site-packages/telegram/ext/handler.py", line 145, in handle_update
    return self.callback(update, context)
TypeError: handle_novel_url() missing 1 required positional argument: 'user_data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/projects/lightnovel-crawler/venv/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 441, in process_update
    self.dispatch_error(update, e)
  File "/root/projects/lightnovel-crawler/venv/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 638, in dispatch_error
    callback(update, context)
TypeError: error_handler() missing 1 required positional argument: 'error'
^C^CWARNING:telegram.ext.updater:Exiting immediately!
(venv) root@TinVultr:~/projects/lightnovel-crawler#

Running command as: TELEGRAM_TOKEN=123:ABCabc BOT=telegram python __main__.py or TELEGRAM_TOKEN=123:ABCabc python __main__.py --bot telegram did not resolve the error. How do you run the Telegram bot from terminal?

dipu-bd commented 3 years ago
  1. The error can be fixed by installing libnss3. Is there a way to tell heroku to install necessary packages. calibre is needed too.
  2. @yudilee maintains the telegram bot. I don't know if it is broken now. Command to run it should be the second one: TELEGRAM_TOKEN=123:ABCabc python __main__.py --bot telegram . It does not need --shard-id and --shard-count by the way
yudilee commented 3 years ago

@dipu-bd https://github.com/dipu-bd to me it seems that he/she run 2 bot instance or more with the same api key. every single bot instance should be run using it's own api key ( means he should asking bot father to create new bot )

On Mon, Nov 9, 2020 at 12:30 AM Sudipto Chandra notifications@github.com wrote:

  1. The error can be fixed by installing libnss3. Is there a way to tell heroku to install necessary packages. calibre is needed too.
  2. @yudilee https://github.com/yudilee maintains the telegram bot. I don't know if it is broken now. Command to run it should be the second one: TELEGRAM_TOKEN=123:ABCabc python main.py --bot telegram

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dipu-bd/lightnovel-crawler/issues/664#issuecomment-723640953, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV5AWZD5URY67GEWLKADUDSO3ISZANCNFSM4TMFJTFQ .

NNTin commented 3 years ago

I'll do a fix regarding libnss3 and --shard-id 0 --shard-count 1. Can't tell when exactly.

dipu-bd commented 3 years ago

@NNTin okay. thanks a lot for helping. If possible install calibre too.

NNTin commented 3 years ago

Calibre should already be installed. In app.json it pulls the Calibre buildpack https://github.com/nntin/heroku-buildpack-calibre