standardnotes / self-hosted

[Legacy] Self-host your own Standard Notes server for end-to-end encrypted notes and files
https://github.com/standardnotes/server
GNU Affero General Public License v3.0
343 stars 39 forks source link

Getting "Sync unreachable" for existing self-hosted install (with Android app) #89

Open 501st-alpha1 opened 1 year ago

501st-alpha1 commented 1 year ago

I'm having some trouble syncing with my self-hosted Standard Notes install for some reason; when I run the Android app and make a change it spins for a second trying to save but then says "Sync unreachable". It was working for me previously, but then I needed to move the server, so it was down for a few weeks before I got around to plugging it back in (and I may have updated the app in the meantime). I updated the server to the latest version, but that didn't help either.

The instance that I'm having trouble with is an Android install of SN, v3.45.4 (3002288). I also have an older version of the iPhone app, v3.35.12 (169), as well as a fresh install on Linux, v3.23.280.

What works:

What doesn't work:

In either case I don't see any errors come in while watching the server logs (./server.sh logs).

Output of ./server.sh version:

             Container                          Repository                 Tag         Image Id       Size
------------------------------------------------------------------------------------------------------------
api-gateway-standalone                standardnotes/api-gateway         latest       b56ad2f20c5b   148.5 MB
auth-standalone                       standardnotes/auth                latest       4a7b2bdeb7ef   162.2 MB
auth-worker-standalone                standardnotes/auth                latest       4a7b2bdeb7ef   162.2 MB
cache-standalone                      redis                             6.0-alpine   83c577984741   24.65 MB
db-standalone                         mysql                             5.6          dd3b2a5dcb48   302.5 MB
files-standalone                      standardnotes/files               latest       ed8f90b70eae   150.4 MB
syncing-server-js-standalone          standardnotes/syncing-server-js   latest       9f9d2bbec8b8   160.5 MB
syncing-server-js-worker-standalone   standardnotes/syncing-server-js   latest       9f9d2bbec8b8   160.5 MB
workspace-standalone                  standardnotes/workspace           latest       b246ed0cc987   159.9 MB
workspace-worker-standalone           standardnotes/workspace           latest       b246ed0cc987   159.9 MB

Is there a way to enable more verbose logging, either for the Android app or server-side? Or is there anything else I can try (short of deleting my data and starting over)?

mostdcoa commented 1 year ago

I am having a similar issue, and just came here to make an issue. If this is a separate problem I will make my own issue thread.

I am unable to use the app, or self-hosted web app on android to connect to my server (over VPN) using the local domain or IP address (using http) on android. The windows client works fine (but also not the web app from windows).

501st-alpha1 commented 1 year ago

(using http)

If you do mean HTTP as opposed to HTTPS, I think I remember the app refusing to connect over unencrypted HTTP, so it has to be HTTPS. (And if you're trying to use a local domain name or IP address, that may break things since the TLS certificate probably won't match.)

501st-alpha1 commented 1 year ago

I set LOG_LEVEL to debug in all the *.env files, but specifically the api-gateway.env is what helped: when I open the (working) iPhone app, I see a couple log entries indicating a sync is occurring.

When I open the (broken) Android app and try to sync / log in, I don't see any such log entries, so it seems like it's not even getting to the server. When I moved the server the IP address changed, so I had updated the DNS, but the changes should have propagated by now. As evidence they have, even aside from the fact the iPhone app works, when I visit my SN domain from a web browser on the same Android device, I correctly see the "Welcome to Standard Notes..." page, so it must be able to reach the server.

Would there be some reason that the Android app would be stuck on the old DNS result?

I even tried completely deleting and reinstalling the app, but even that didn't help.

mostdcoa commented 1 year ago

(using http)

If you do mean HTTP as opposed to HTTPS, I think I remember the app refusing to connect over unencrypted HTTP, so it has to be HTTPS. (And if you're trying to use a local domain name or IP address, that may break things since the TLS certificate probably won't match.)

@501st-alpha1 Thanks, got it fixed.

I set LOG_LEVEL to debug in all the *.env files, but specifically the api-gateway.env is what helped: when I open the (working) iPhone app, I see a couple log entries indicating a sync is occurring.

When I open the (broken) Android app and try to sync / log in, I don't see any such log entries, so it seems like it's not even getting to the server. When I moved the server the IP address changed, so I had updated the DNS, but the changes should have propagated by now. As evidence they have, even aside from the fact the iPhone app works, when I visit my SN domain from a web browser on the same Android device, I correctly see the "Welcome to Standard Notes..." page, so it must be able to reach the server.

Would there be some reason that the Android app would be stuck on the old DNS result?

I even tried completely deleting and reinstalling the app, but even that didn't help.

I am having this same issue. Nothing is showing up in the logs when attempting to authenticate with an android device.

Tested using: Virtual Private Server (OpenVPN Server - 192.168.100.0/24 Subnet) Synology NAS (Standard Notes Docker) - 192.168.100.100 Glinet Wireless access point - 192.168.8.0/24 LAN // 192.168.100.2 OpenVPN IP Windows 10 Laptop Pixel 6A w/ GrapheneOS (192.168.8.106 (Glinet Subnet) Web browsers: Brave (Windows and Phone) and Vanadium (Phone) Standard Notes Android Application Version 3.45.42 Standard Notes Windows Application Version 3.23.279

Error: "Unknown error." displayed in App and Browsers.

Setup: Access point has OpenVPN client certificate that provides VPN access to remote resources for connection clients. Standard Notes self-hosted is being ran in docker container through Synology's native docker application. Lets Encrypt TLS certificates are used on the OpenVPN Server (VPS) and Synology. External:Internal port is proxied through Synology's proxy manager for TLS.

Steps: Windows 10 connected to Access Point via ethernet Can use the browser (Brave) and windows application to connect and sync to remote self-host standard notes using domain:port.

Phone connected via Wifi to Access Point Can use the browser (Brave) to connect and sync to remote self-host standard notes using app.standardnotes.com and connect to custom sync server using domain:port. Cannot use the Android application to connect and sync to remote self-host standard notes using domain:port. Receive Unknown error on the app using the same domain:port address on the phone.

Logs: ./server.sh logs does not show anything when attempting to log in with Android Standard Notes application

TCPdump shows TCP and TLS handshake between remote host and client when using the android application SN Wireshark

Observation: In the Android App, I can check or uncheck the "Custom Sync Server" and the application will use whatever address is in the custom sync server URL box. I do not know if this issue is related.

Example 1: Check the "Custom Sync Server" box Type your custom sync server URL in the Custom Sync Server field Type your username/password and sign in You will receive the "Unknown Error" Uncheck the "Custom Sync Server" Box Type your username/password and sign in You will receive the "Unknown Error"

Example 2 Check the "Custom Sync Server" box Type https://api.standardnotes.com into the Custom Sync Server field Type your username/password and sign in You will authenticate with api.standardnotes.com Uncheck the "Custom Sync Server" Box You will authenticate with api.standardnotes.com

Intended Result: Check the "Custom Sync Server" box Type your self-hosted sync server address into the Custom Sync Server field Type your username/password and sign in You will authenticate with your self-hosted sync server Uncheck the "Custom Sync Server" Box You will authenticate with api.standardnotes.com