Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] websocket connection ignore http_proxy and https_proxy #1121

Open
xcpky opened this issue Dec 31, 2024 · 12 comments
Open

[Bug] websocket connection ignore http_proxy and https_proxy #1121

xcpky opened this issue Dec 31, 2024 · 12 comments
Assignees

Comments

@xcpky
Copy link

xcpky commented Dec 31, 2024

Bug Description

I cannot sync with appflowy cloud, the log says websocket connection keeps trying.
for example, any modification locally in the client aren't synced to the cloud, ie I cannot see it in the web or android client.
I can indeed login and publish to web though. And the first time I login in a freshly installed client I can fetch all the synced pages.

How to Reproduce

open the app and sign in

Expected Behavior

everything syncs with the cloud

Operating System

archlinux

AppFlowy Version(s)

0.7.9

Screenshots

No response

Additional Context

logs here

{"msg":"[GET_WORKSPACES_OPT - END]","time":"12-31 18:51:35","target":"client_api::http"}
  2024-12-31 18:51:42  INFO client_api::retry: 🔵websocket start connecting
    at /home/runner/.cargo/git/checkouts/appflowy-cloud-875aed6322f3953d/ea131f0/libs/client-api/src/retry.rs:110

{"msg":"🔵websocket start connecting","time":"12-31 18:51:42","target":"client_api::retry"}
  2024-12-31 18:51:42  INFO flowy_server::af_cloud::server: [websocket] state: Connecting
    at flowy-server/src/af_cloud/server.rs:309

{"msg":"[websocket] state: Connecting","time":"12-31 18:51:42","target":"flowy_server::af_cloud::server"}
  2024-12-31 18:51:57  INFO client_api::retry: 🔵websocket start connecting
    at /home/runner/.cargo/git/checkouts/appflowy-cloud-875aed6322f3953d/ea131f0/libs/client-api/src/retry.rs:110

{"msg":"🔵websocket start connecting","time":"12-31 18:51:57","target":"client_api::retry"}
  2024-12-31 18:52:12  INFO client_api::retry: 🔵websocket start connecting
    at /home/runner/.cargo/git/checkouts/appflowy-cloud-875aed6322f3953d/ea131f0/libs/client-api/src/retry.rs:110

{"msg":"🔵websocket start connecting","time":"12-31 18:52:12","target":"client_api::retry"}
  2024-12-31 18:52:28  INFO client_api::retry: 🔵websocket start connecting
    at /home/runner/.cargo/git/checkouts/appflowy-cloud-875aed6322f3953d/ea131f0/libs/client-api/src/retry.rs:110

{"msg":"🔵websocket start connecting","time":"12-31 18:52:28","target":"client_api::retry"}
  2024-12-31 18:52:43  INFO client_api::retry: 🔵websocket start connecting
    at /home/runner/.cargo/git/checkouts/appflowy-cloud-875aed6322f3953d/ea131f0/libs/client-api/src/retry.rs:110

{"msg":"🔵websocket start connecting","time":"12-31 18:52:43","target":"client_api::retry"}
@khorshuheng
Copy link
Collaborator

Does this happen only for the desktop client? Or mobile client too?

@khorshuheng
Copy link
Collaborator

And by any chance, are you behind some VPN/firewall?

@xcpky
Copy link
Author

xcpky commented Dec 31, 2024

Does this happen only for the desktop client? Or mobile client too?

only for desktop client.

And by any chance, are you behind some VPN/firewall?

yes I am using clash, I set http_proxy, https_proxy and all_proxy variables in linux.
my mobile client also uses a vpn, but it works.

@xcpky
Copy link
Author

xcpky commented Dec 31, 2024

if i use tun mode of clash, that is let clash handles all the traffic by using a virtual network interface instead of passing environment variables like http_proxy, then the sync seems to work and the websocket can connect.

so the problem might be the websocket ignores http_proxy, https_proxy and all_proxy variables?

@khorshuheng
Copy link
Collaborator

I am not too familiar with VPN and networking, so I can't give a definitive answer right now. What I can say is, the client will first make a http/https request to Appflowy cloud, then upgrade this connection to a websocket connection. But the established websocket connection, might not be going through the VPN, at least, without using tunneling.

@xcpky
Copy link
Author

xcpky commented Dec 31, 2024

I believe websocket connection in appflowy doesn't read proxy settings from environment variables(*_proxy) or GNOME system proxy. I think this function should be implemented. For curl, they read wss_proxy or https_proxy if it isn't set. curl/curl#12031
For best linux user experiences, all_proxy could be considered too.

@xcpky
Copy link
Author

xcpky commented Dec 31, 2024

@annieappflowy annieappflowy transferred this issue from AppFlowy-IO/AppFlowy Jan 3, 2025
@annieappflowy
Copy link
Collaborator

Transferred to the cloud repo

@xcpky
Copy link
Author

xcpky commented Jan 3, 2025

why is this issue closed?

@khorshuheng khorshuheng reopened this Jan 3, 2025
@khorshuheng
Copy link
Collaborator

Sorry, I have reopened the issue. Let me update the title to better reflect the issue.

@khorshuheng khorshuheng changed the title [Bug] websocket connection keeps retrying [Bug] websocket connection ignore http_proxy and https_proxy Jan 3, 2025
@xcpky
Copy link
Author

xcpky commented Jan 4, 2025

Is this really a cloud server issue? Shouldn't the client take care of the proxy?

@khorshuheng
Copy link
Collaborator

khorshuheng commented Jan 4, 2025

The client library is in this repository, which is used by the frontend.

https://github.com/AppFlowy-IO/AppFlowy-Cloud/blob/main/libs/client-websocket/src/native.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants