ddvk / rmfakecloud

host your own cloud for the remarkable
GNU Affero General Public License v3.0
700 stars 57 forks source link

Sync the server return 500 #270

Closed momaek closed 3 months ago

momaek commented 7 months ago

Server system: Alibaba Cloud Linux release 3 (Soaring Falcon) Run in docker. Logs:

time="2023-11-18T13:44:34Z" level=info msg="Listening on port: 3000"
time="2023-11-18T13:44:34Z" level=info msg="Using plain HTTP"
time="2023-11-18T13:44:36Z" level=info msg="[auth-middleware] UserId: root deviceId: {mydeviceID} newSync: true"
time="2023-11-18T13:44:36Z" level=info msg="connecting websocket from: root"
time="2023-11-18T13:44:36Z" level=info msg="[GIN] 2023/11/18 - 13:44:36 | 200 |     293.437µs |   {myip} | GET      \"/notifications/ws/json/1\""
time="2023-11-18T13:44:36Z" level=debug msg="hub: adding a client"
time="2023-11-18T13:44:36Z" level=info msg="[auth-middleware] UserId: root deviceId: {mydeviceID} newSync: true"
time="2023-11-18T13:44:36Z" level=debug msg="Fullpath: /data/users/root/sync/root"
time="2023-11-18T13:44:36Z" level=error msg="not found"
time="2023-11-18T13:44:36Z" level=info msg="[GIN] 2023/11/18 - 13:44:36 | 500 |      213.96µs |   {myip} | GET      \"/sync/v3/root\""
time="2023-11-18T13:44:37Z" level=info msg="[auth-middleware] UserId: root deviceId: {mydeviceID} newSync: true"
time="2023-11-18T13:44:37Z" level=debug msg="Fullpath: /data/users/root/sync/root"
time="2023-11-18T13:44:37Z" level=error msg="not found"
time="2023-11-18T13:44:37Z" level=info msg="[GIN] 2023/11/18 - 13:44:37 | 500 |     233.593µs |   {myip} | GET      \"/sync/v3/root\""
time="2023-11-18T13:44:40Z" level=info msg="[auth-middleware] UserId: root deviceId: {mydeviceID} newSync: true"
time="2023-11-18T13:44:40Z" level=debug msg="Fullpath: /data/users/root/sync/root"
time="2023-11-18T13:44:40Z" level=error msg="not found"
time="2023-11-18T13:44:40Z" level=info msg="[GIN] 2023/11/18 - 13:44:40 | 500 |      164.99µs |   {myIP} | GET      \"/sync/v3/root\""

Any ideas?

momaek commented 7 months ago

I've fixed the issue by uploading a file to the server.

borispulyer commented 7 months ago

Argh...took me ages of unsuccessful searching until I found your fix. Works like a charm now! Thanks for sharing!

nemunaire commented 7 months ago

We need to fix this behavior.

I try to create a patch in order to avoid returning a 500 error. But it need tests from a new account.

Eeems commented 7 months ago

When I initially setup rmfakecloud I don't remember encountering this, but that might be because I was using toltec. So all of my documents were marked for resync as part of configuring my rmfakecloud server https://github.com/toltec-dev/toltec/blob/7911eacd7256b0c813e496a41344757a7dcb2c2f/package/rmfakecloud-proxy/rmfakecloudctl#L76-L78

    # Mark all files as not synced
    grep sync "$xochitl_data_dir"/*.metadata -l \
        | xargs sed -i 's/synced\": true/synced\": false/'

So the documents on my device were immediately uploaded on the first sync.

nemunaire commented 7 months ago

This error appears since the introduction of the /sync/v3/root route, in v3.4.

I'll create a new account to test the patch, and use the command to mark all files are not synced. I think this should simulate the situation.

nehlsen commented 6 months ago

I've fixed the issue by uploading a file to the server.

WARNING: to anybody trying this: This will start a new sync and remove all existing Files from your device to replace them with the one uploaded to the server.

This will effectively wipe all your files. Happened to me :( After this, everything works fine :)

nunofgs commented 4 months ago

Thanks for the fix. Any chance we can get a release?

nemunaire commented 3 months ago

The expected answer is not a fake root, but a 404 with {"message":"root not found"}.

I'll fix this and make a release.