ankicommunity / ankicommunity-sync-server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb)
GNU Affero General Public License v3.0
881 stars 81 forks source link

Syncing error: ⁨error decoding response body: missing field `mod` at line 1 column 99 #117

Open gla23 opened 2 years ago

gla23 commented 2 years ago

When I sync to the server, Anki shows this error:

Error details: ⁨error decoding response body: missing field mod at line 1 column 99 Screenshot 2021-12-22 at 10 53 15

At which point the running process on the backend gives the following output:

[2021-12-22 10:53:27,019]:INFO:ankisyncd.http:127.0.0.1 "GET /msync/begin?k=4b3a8990496166b7c559a3a63fd064b2&v=anki%2C2.1.49+%28dc80804a%29%2Cmac%3A10.16 HTTP/1.1" 403 157
[2021-12-22 10:53:27,045]:INFO:ankisyncd.CollectionThread[ggwp]:Running meta(*[], **{'v': 10, 'cv': 'anki,2.1.49 (dc80804a),mac:10.16'})
[2021-12-22 10:53:27,046]:INFO:ankisyncd.http:127.0.0.1 "POST /sync/meta HTTP/1.1" 200 99

⁩It looks like the /msync/begin call is failing (returns a 443) and so understandably the frontend is confused when there's no body on the response.

How can I start debugging this?

By the way I'm using apache with this in the VirtualHost for the proxy. According to what I could find on stack overflow the SetEnv proxy-sendcl 1 line should be unchunking the requests properly.

  ProxyPreserveHost On
  ProxyRequests Off
  ProxyPass /anki/ http://localhost:27701/
  ProxyPassReverse /anki/ http://localhost:27701/

  SetEnv proxy-sendcl 1 
dobefore commented 2 years ago

sorry,totally unfamiliar with apache. How about switching to other reverse proxies,like nginx and caddy? here is a good example on how to configure nginx https://github.com/ankicommunity/anki-sync-server/issues/97 After you test with nginx,if no problem with it,then the culprit is apache. feel free to add

kanjieater commented 2 years ago

I'm getting this as well, and using nginx. Even without the reverse proxy this occurs. I'm currently on Anki 2.1.35.

dobefore commented 2 years ago

this may help #56

gla23 commented 2 years ago

Thanks for the reply. Unfortunately I had a proper look through #56 before creating this issue and couldn't find anything that helps. I tried the git reset in this comment but the commit hash doesn't exist.

The OP fixed their issue by updating their sync server to the newest version. When I do git fetch, I'm already on the latest version (41205c0b92290bc3dc6e50d401dc9dbf33bdd52c)

Not sure where to go from here.

dobefore commented 2 years ago

one more thing to confirm,are you under develop branch?

gla23 commented 2 years ago

Oh it turns out I was on the wrong repository! Somehow I had origin set as a different anki-sync-server fork. I should have noticed that something was off in my previous comment when the commit hash didn't exist...

I'm on the develop branch now. When I run what previously started the server (python -m ankisyncd) as explained in the readme, I get:

/usr/bin/python: No module named ankisyncd.__main__; 'ankisyncd' is a package and cannot be directly executed

I'm guessing this is because there's been an undocumented restructure and it no longer works the same way? I've installed the new dependencies with pip install -r src/requirements.txt.

GustavoDouradoSilva commented 2 years ago

had same issue while running anki-official-binary-bundle 2.1.49-1 on manjaro linux. "Solved" it by running 2.1.15 https://github.com/ankitects/anki/releases/tag/2.1.15

I got this problem because i am using anki-sync-server which i link to the server using http and ip

MrDrache333 commented 2 years ago

Same problem here with Anki Desktop for macOS on macOS 12.3 and Anki 2.1.49 and the latest Docker Image.

Love4yzp commented 2 years ago

Anki 2.1.49

Using the docker Anki sync server, I changed my AnkiDroid version below 3.10 (V3.9.7), which helps me solve the SSL Problem

But on PC, I have no idea.