janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.93k stars 1.38k forks source link

Kobo sync failure #1815

Open PipeItToDevNull opened 3 years ago

PipeItToDevNull commented 3 years ago

I checked the other issues and did not find anything I could make sense of to resolve this.

Describe the bug/problem 'Failed to sync' on Kobo Clara device

To Reproduce Steps to reproduce the behavior:

  1. Add API key from calibre-web to ereader.conf
  2. Reboot Clara
  3. Force Sync
  4. 'Sync failed. Please try again'

Logfile

[2021-01-17 11:11:24,633]  INFO {cps.kobo:913} Init
[2021-01-17 11:11:24,634] DEBUG {cps.kobo:928} Kobo: Received unproxied request, changed request port to external server port
[2021-01-17 11:11:24,634] DEBUG {cps.kobo:938} Kobo: Received unproxied request, changed request url to http://library.dev0.sh:8083
[2021-01-17 11:11:24,681] DEBUG {cps.kobo:851} Unimplemented User Request received: http://library.dev0.sh/kobo/<key>/v1/user/profile
[2021-01-17 11:11:24,821] DEBUG {cps.kobo:851} Unimplemented User Request received: http://library.dev0.sh/kobo/<key>/v1/user/loyalty/benefits
[2021-01-17 11:11:24,855] DEBUG {cps.kobo:851} Unimplemented User Request received: http://library.dev0.sh/kobo/<key>/v1/analytics/gettests

Environment (please complete the following information):

Additional context The URL http://library.dev0.sh:8083/kobo/<key>/v1/library/sync works, and has a list of my books (I assume in a proper fomat)

I only have 20-30 books present in my library.

Side note, is this sync supposed to download my entire library to my Kobo device?

OzzieIsaacs commented 3 years ago

Side note, is this sync supposed to download my entire library to my Kobo device

It will download the metadata (name and cover) of all books which are not set to "archived" to your e-reader. You can choose afterwards to download the books one by one

From the logs it looks halfway good. The log should show: "Init" "Kobo: Received unproxied request,..." "Kobo: Received unproxied request,..."

Then there should be a: "Kobo Auth request" "Kobo library sync request received." Followed by some unimplemented library and user request messages

So the kobo reader finds the Calibre-Web instance, but seems not to sync with it. Could you please try to uodate to 0.6.10, which was released last weekend and try again. You could activate the access log, this also could help to figure out which requests are received. If this isn't working, we should try to debug it using Wireshark to check what's going on.

PipeItToDevNull commented 3 years ago

I updated to .10, it did not resolve my issue

[2021-01-18 17:07:17,798]  INFO {cps.kobo:937} Init
[2021-01-18 17:07:17,799] DEBUG {cps.kobo:952} Kobo: Received unproxied request, changed request port to external server port
[2021-01-18 17:07:17,799] DEBUG {cps.kobo:962} Kobo: Received unproxied request, changed request url to http://library.dev0.sh:8083
[2021-01-18 17:07:17,844] DEBUG {cps.kobo:874} Unimplemented User Request received: http://library.dev0.sh/kobo/<key>/v1/user/profile
[2021-01-18 17:07:17,939] DEBUG {cps.kobo:874} Unimplemented User Request received: http://library.dev0.sh/kobo/<key>/v1/user/loyalty/benefits
[2021-01-18 17:07:17,962] DEBUG {cps.kobo:874} Unimplemented User Request received: http://library.dev0.sh/kobo/<key>5/v1/analytics/gettests
::ffff:10.10.10.99 - - [2021-01-18 17:07:06] "GET /admin/logfile HTTP/1.1" 200 9117 0.024945
::ffff:10.10.10.99 - - [2021-01-18 17:07:06] "GET /static/css/libs/bootstrap.min.css HTTP/1.1" 304 622 0.014226
::ffff:10.10.10.99 - - [2021-01-18 17:07:06] "GET /static/css/upload.css HTTP/1.1" 304 620 0.013310
::ffff:10.10.10.99 - - [2021-01-18 17:07:06] "GET /static/css/style.css HTTP/1.1" 304 621 0.012901
::ffff:10.10.10.99 - - [2021-01-18 17:07:07] "GET /ajax/log/0?_=1611007635387 HTTP/1.1" 200 3703 0.013119
::ffff:10.10.10.99 - - [2021-01-18 17:07:07] "GET /static/favicon.ico HTTP/1.1" 200 62382 0.012904
::ffff:10.10.10.13 - - [2021-01-18 17:07:17] "GET /kobo/<key>/v1/initialization HTTP/1.1" 200 9054 0.022225
::ffff:10.10.10.13 - - [2021-01-18 17:07:17] "GET /kobo/<key>/v1/user/profile HTTP/1.1" 200 560 0.012995
::ffff:10.10.10.13 - - [2021-01-18 17:07:17] "GET /kobo/<key>/v1/user/loyalty/benefits HTTP/1.1" 200 560 0.012589
::ffff:10.10.10.13 - - [2021-01-18 17:07:17] "POST /kobo/<key>/v1/analytics/gettests HTTP/1.1" 200 560 0.013696
::ffff:10.10.10.13 - - [2021-01-18 17:07:18] "POST /kobo/<key>/v1/user/add-device HTTP/1.1" 404 1738 0.017127
::ffff:10.10.10.99 - - [2021-01-18 17:07:21] "GET /admin/logfile HTTP/1.1" 200 9117 0.028882
::ffff:10.10.10.99 - - [2021-01-18 17:07:21] "GET /static/css/style.css HTTP/1.1" 304 621 0.014774
::ffff:10.10.10.99 - - [2021-01-18 17:07:21] "GET /static/css/upload.css HTTP/1.1" 304 620 0.012937
::ffff:10.10.10.99 - - [2021-01-18 17:07:21] "GET /static/css/libs/bootstrap.min.css HTTP/1.1" 304 622 0.012699
::ffff:10.10.10.99 - - [2021-01-18 17:07:21] "GET /ajax/log/0?_=1611007649749 HTTP/1.1" 200 4511 0.013436
::ffff:10.10.10.99 - - [2021-01-18 17:07:21] "GET /static/favicon.ico HTTP/1.1" 200 62382 0.014980

.99 is my workstation and .13 is the kobo

PipeItToDevNull commented 3 years ago

Using tcpdump on the server I see

15  3.942990    10.10.10.13 172.19.0.5  HTTP    8083    57587   1087    GET /kobo/aca0d3cf4a8684d37cfcf6f3c8b74885/v1/initialization HTTP/1.1 
54  3.992646    10.10.10.13 172.19.0.5  HTTP    8083    57587   715 GET /kobo/aca0d3cf4a8684d37cfcf6f3c8b74885/v1/user/profile HTTP/1.1 
69  4.089096    10.10.10.13 172.19.0.5  HTTP    8083    57587   724 GET /kobo/aca0d3cf4a8684d37cfcf6f3c8b74885/v1/user/loyalty/benefits HTTP/1.1 
90  4.183747    10.10.10.13 172.19.0.5  HTTP/JSON   8083    57587   213 POST /kobo/aca0d3cf4a8684d37cfcf6f3c8b74885/v1/analytics/gettests HTTP/1.1 , JavaScript Object Notation (application/json)
102 4.224407    10.10.10.13 172.19.0.5  HTTP/JSON   8083    57587   283 POST /kobo/aca0d3cf4a8684d37cfcf6f3c8b74885/v1/user/add-device HTTP/1.1 , JavaScript Object Notation (application/json)

plus lots of random TCP, I can include that if needed

ProtoJazz commented 3 years ago

I'm also using the same docker image and running into the same deal. I can hit the api in the browser and get things just fine now (Previously I had issues with a large library)

But on the kobo it just spins for a bit and fails without any real errors I can find in the caliber-web logs. I tried both with and without my reverse proxy domain, but both work fine on the broswer and fail on the kobo. I can't be sure if they both fail the same way though.

WesSec commented 3 years ago

I can add that I experience the same problem (linuxserver image 0.6.10), without proxy everything is fine, with proxy I get:

[2021-01-23 22:34:53,441] DEBUG {cps.kobo:874} Unimplemented User Request received: https://books.<mydomain>.<tld>/kobo/<key>/v1/user/profile
[2021-01-23 22:34:53,510] DEBUG {cps.kobo:874} Unimplemented User Request received: https://books.<mydomain>.<tld>/kobo/<key>/v1/user/loyalty/benefits
[2021-01-23 22:34:53,627] DEBUG {cps.kobo:874} Unimplemented User Request received: https://books.<mydomain>.<tld>/kobo/<key>/v1/analytics/gettests
[2021-01-23 22:34:53,714]  INFO {cps.kobo:138} Kobo library sync request received.

The request and error are reproducible in postman. The ereader device I'm using is the Libra H20 with software version 4.25.15875

This is the current proxy (nginx) config I'm running:

    location / {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_app calibre-web;
        set $upstream_port 8085;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
        proxy_set_header      X-Scheme $scheme;
    }

And when i direct connect (to internal IP incl port 8085) it works like a charm. no errors at all In the Webui i have both webui and API port set to 8085, the proxy should be able to redirect hem.

Please let me know if any additional settings/logs may help solving this problem, would love to be able to sync remotely

EDIT: as this is a proxy related problem and OP does not use a proxy this is probably not related

PipeItToDevNull commented 3 years ago

I am not running through a proxy at all for my logs

WesSec commented 3 years ago

Alrighty sorry for my misunderstanding, the usage of the sh TLD made me think otherwise

PipeItToDevNull commented 3 years ago

Alrighty sorry for my misunderstanding, the usage of the sh TLD made me think otherwise

It wasn't an accusation of any kind, I just wanted the thread to be clear. The issue occurs with both configurations