Code Monkey home page Code Monkey logo

Comments (33)

vrtmrz avatar vrtmrz commented on July 17, 2024 2

Sorry for being delayed!
I think that this is caused by the limitations of iOS 17; which are reported also by other plug-ins.

Please wait for the official position to be confirmed or use public DNS and certificates like @thany
In earlier days, I have previously addressed this foreseen issue and posted a feature request. And it also appears to have received renewed attention.

I hope that the situation will be better.

P.S. Originally, I would like to write replies one at a time, but as my appearance has been very late and the story is progressing with your help, I have added the most important topics from this Issue to the Tips and troubleshooting. Please read this one as well.

from obsidian-livesync.

knighthell avatar knighthell commented on July 17, 2024 1

@thany @vrtmrz

I have the same problem. After some testing, the problem was resolved successfully in both Desktop App (Mac, Windows) and Mobile App (Android, Ipad).

The likely cause is that there are restrictions on http (non-secure) access to the app on the mobile OS. Therefore, after working on https support, everything was accessible from couchdb.

Previously, in the desktop app, you could access couchdb's ip (e.g. local: 192.168.1.100, isp: 123.123.123.123:5684) and hostname (e.g. http://myhostname.com:5684), but you could not access it by hostname only on mobile. (Internal IP and external IP were available)

So, I set the subdomain to couchdb.myhostname.com, obtained a let's encryted certificate for it, set up reverse-proxy, and accessed https://couchdb.myhostname.com, and both Desktop and Mobile were successful.
( Obsidian --> https://couchdb.myhostname.com --> reverse-proxy --> http://192.168.1.100:5984 )

Previously, when developing PWA, there was an issue where the mobile app could not access http (non secure), so I tested it and it worked well.

I hope this helps.

from obsidian-livesync.

telwell avatar telwell commented on July 17, 2024 1

@knighthell inspired me to fix this on my own setup, I wrote a post to help future people facing this issue.

@thany I'm not sure what your issue could be exactly. One thing I didn't get right at first was setting up my reverse proxy config. Obsidian uses the database name as the path (e.g. if your site is foo.bar and your database is sync you'll get pinged at foo.bar/sync). Could you share some more of your setup and maybe we can help debug?

from obsidian-livesync.

thany avatar thany commented on July 17, 2024 1

@telwell It has worked before. I just suddenly stopped working. I didn't touch my proxy setup.

But to repeat myself: I can access the database from a browser, using the exact same URL and credentials, on the same device. So the only variable is the app.

So what do you want me to share exactly?

from obsidian-livesync.

kylek29 avatar kylek29 commented on July 17, 2024

I have a similar problem, except mine says it successfully replicates. However, changes never get pushed to the desktop. It was working fine between all devices, but stopped this week -- just checking, Obsidian pushed the 1.5.8 version to both desktop and mobile on February 22nd, so I think something changed which may be affecting sync. Completely redid the database, no fix. Redid all of the LiveSync settings one-device at a time, no change. DB reflects Desktop -> DB, but mobile seems to be having issues (renames, add blocks to notes, etc. don't reflect back).

edit
Some more testing.

  • Completely blew out both devices (desktop and mobile) and database.
  • Setup on desktop and let it sync to (is master, has all of the documents) the new database, worked fine.
  • Setup on mobile and let it pull to a fresh (empty) folder, worked fine, initial fetch replicated successfully.
  • With mobile app closed and using desktop app -> edited a document on Desktop, document properly reflected in CouchDB changelog.
  • With desktop app closed and using mobile app -> let it sync .. document change does not reflect.
  • With desktop app closed and using mobile app -> tried to edit a different file and let it sync .. document change is not reflected in CouchDB changelog.

I tried to rollback both the versions of Desktop/Mobile to test the theory it's something in the new update, but the apps won't let me rollback even if I use the prior installs (I think it may pull the latest release even when installing using an older version).

edit2

One oddity is that I noticed the "Database Suffix" under "Hatch" is set to a generated string on Desktop. This was always empty before this week. If I reset it to something else, it always go back to that same generated string (even if I do it before initializing the db).

On the mobile app, it always reflects the vault name. Same issues apply when trying to rename. There's no documentation on this setting, so I'm not sure if they have to be different or if they're supposed to be the same. No matter what, I can't get them to use the same value on the same database.

When I get home I'll likely set it up on another Windows desktop and see if that exhibits the same behavior or if it successfully syncs. If it does, then it would seem to be a mobile issue.

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

It's be helpful if the actual error could be pushed to the log. Because the log can be viewed on mobile without any hassle. It's frustrating to not know whether it's a boring 404, or some certificate error, or a network failure of sorts. No idea. Not even a clue. Shouldn't be that hard to put at least something in the log, right?

@kylek29 The problem in my case is that the server just simply cannot be reached (for unknown reason) so any configuration or credentials on CouchDB is irrelevant in my scenario.

from obsidian-livesync.

Recte avatar Recte commented on July 17, 2024

I am experiencing the same issue. I use a local DNS name for my database, only available on my DNS server.
When I go to the database using the DNS name in a browser, all is fine. When I Sync tries to connect, the log writes:

Could not connect to http://<my local dns name>:<port>/<table> TypeError:Load failed

When I change the DNS name for the local IP address, all works fine...

I checked my DNS and could not find the DNS lookup for the specific domain by my mobile, but maybe I just overlooked it.

Edit: In my case it's on iOS by the way

from obsidian-livesync.

kylek29 avatar kylek29 commented on July 17, 2024

The problem in my case is that the server just simply cannot be reached

I didn't mention it specifically, but I did get one notification of "Network Issue" on mobile. I'm not sure if iPhone allows you to do this like Android, but you can download and manually install the Obsidian Dev Tools plugin from here: https://github.com/KjellConnelly/obsidian-dev-tools --> it allows full access to the console like Desktop. It's not actively maintained, so I put some instructions here: KjellConnelly/obsidian-dev-tools#8

There were a few LiveSync plugin updates pushed last night (0.22.9?) and my issue went away for now, so maybe give the update a try?

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

Latest update doesn't fix this.

from obsidian-livesync.

Liujun3712 avatar Liujun3712 commented on July 17, 2024

I am experiencing the same issue. I use a local DNS name for my database, only available on my DNS server. When I go to the database using the DNS name in a browser, all is fine. When I Sync tries to connect, the log writes:

Could not connect to http://<my local dns name>:<port>/<table> TypeError:Load failed

When I change the DNS name for the local IP address, all works fine...

I checked my DNS and could not find the DNS lookup for the specific domain by my mobile, but maybe I just overlooked it.

Edit: In my case it's on iOS by the way

I have the same issue on ipad and iphone.

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

I use a publicly available DNS name for my server, and indeed, on my laptop when away from home, it works perfectly fine.

from obsidian-livesync.

iclosed avatar iclosed commented on July 17, 2024

I have the same problem.
Test Database Connection comes out with "could not connect to ....(TypeError:Load failed)" on iOS
However it works on PC with the same config.

from obsidian-livesync.

alx-xlx avatar alx-xlx commented on July 17, 2024

I am getting similar error, I lost track of the plugin update that broke it on the iOS. It was working well few days ago, unfortunately now the connection to the server isn't established, even when the couchdb instance is working fine and is accessible on windows obsidian

from obsidian-livesync.

Recte avatar Recte commented on July 17, 2024

Sorry for being delayed! I think that this is caused by the limitations of iOS 17; which are reported also by other plug-ins.

I can confirm it's on iPadOS17 and iOS16.
And for the record, in my case it works on Obsidian Windows and fails on mobile. On mobile it works when I enter the local IP address but not when I use the (local/internal) DNS name, which works fine on Windows.

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

@vrtmrz And what about my issue? It being the original issue and all... Certificates are not an issue in my scenario. Or at least they shouldn't be, as my server is on HTTPS with a publicly trusted certificate by Letsencrypt.

@knighthell Yes that's exactly the setup that I have. Reverse proxy. And as said before: it works perfectly fine, both on desktop and in a mobile browser. If it works in a browser on mobile, but not in the app, how the hecko could my setup ever be the problem? Clearly the DB is reachable from my mobile device!

from obsidian-livesync.

telwell avatar telwell commented on July 17, 2024

@thany If the connection is working and the only variable is the origin of the connection, it could be a CORS issue in your proxy.

How is the reverse proxy set up?

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

It is not a CORS issue. It is working perfectly on Obsidian desktop.

Also a CORS issue gives a different error, both when trying to sync and when testing connection in the settings.

But to answer your question, if you must know my reverse proxy config:

<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName couch.domainname.nl
  ProxyPass / http://unraid:5384/
  ProxgPassReverse / http://unraid:5384/
  ErrorLog log
  RewriteEngine on
  RewriteCond %{SERVER_NAME} =couch.domainname.nl
  RewriteRule ^ https://%{SERVER-NAME}%{REQUEST-URI} [END,NE,R=permanent]
</VirtualHost>

("domainname" is not real, it's just to protect my privacy)

from obsidian-livesync.

leon80148 avatar leon80148 commented on July 17, 2024

I also get the same problem, that it couldn't conned to the server. I found it only could't work on iphone, but could work in my ipad suscessly. So i think the problem only happen on "iphone".

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

Not only iPhone, I'm on Android.

Also I've tried it on non-secure HTTP and it gives the same error, which rules out any SSL/TLS misconfiguration (as expected, since, again, it works fine in any browser and on the desktop application)

from obsidian-livesync.

Fluxstone avatar Fluxstone commented on July 17, 2024

Adding some more Feedback here myself: iOS does not work. Checked that Certificate is working (LetsEncrypt, HTTPS Connection does work). Working from my Ipad, Mac and WIndows machine I have no issues. Only my iPhone doesn't connect. Reinstalling obsidian and reconfiguring the plugin did not fix the issue as well.

from obsidian-livesync.

knighthell avatar knighthell commented on July 17, 2024

I think we need to collect a lot of cases for fix. This is my testing environment.

Test OS : MacOS, Windows, Android, IPadOS
couchdb version : 3.3.3 (using docker)

problems
The reason why I fixed this problem was that I first tested it on the internal network and there was no problem,
so I tested it through the domain and the problem occurred because the mobile device could not synchronize.

In my case, On the internal network, ALL OS worked well.(e.g. internal couchdb ip : 192.168.1.100:5984)
I think that if everything works normally when tested on the internal network, obsidian and plugins can be considered normal.

and

using domain( URI : http://myhostname.com:5984 using nginx reverse proxy), MacOS and Windows ware successful
but, It failed on iPadOS and Android.
http://myhostname.com points to http://192.168.1.100
Error Message was "Connection Failed"

so, I applied HTTPS subdomain(using Let's Encrypted and nginx reverce proxy) couchdb.myhostname.com
https://couchdb.myhostname.com points to http://192.168.1.100:5984
and now successful about ALL OS

This is my case.

from obsidian-livesync.

joshmcorreia avatar joshmcorreia commented on July 17, 2024

@telwell It has worked before. I just suddenly stopped working. I didn't touch my proxy setup.

But to repeat myself: I can access the database from a browser, using the exact same URL and credentials, on the same device. So the only variable is the app.

So what do you want me to share exactly?

I'm having this exact issue as well. It worked one day on my iPhone and the next day it just stopped working. I didn't change any settings and it continues to work on desktop, but the app just doesn't want to work for whatever reason.

Also in case it's important, my logs show the same generic error message "TypeError: Load failed".

from obsidian-livesync.

vrtmrz avatar vrtmrz commented on July 17, 2024

Sorry for the long absence!

As you all have mentioned, this is the problem of our hosts having to have a certificate now. And if they try to loosen this, I think they will be very careful in their decision. It is reasonable. (Of course, some believe that self-signed certificates are not a bad idea as long as they are stored in the local certificate store).

The solution of @telwell would be nice. This might be the best way to handle this. Another (and a bit easier, but less independent) solution can be using Cloudflare Tunnel.

@thany

Your confusion is very understandable. More I am weak in Apache...

We need a bit more configuration. Please refer to the official doc. If there are no nocanon on ProxyPass and no ProxyPreserveHost, which possibly is apart from the reason it is mentioned, a CORS error may eventually occur.

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

Your confusion is very understandable. More I am weak in Apache...

We need a bit more configuration. Please refer to the official doc. If there are no nocanon on ProxyPass and no ProxyPreserveHost, which possibly is apart from the reason it is mentioned, a CORS error may eventually occur.

I really don't think my proxy config is the issue here. I keep repeating myself, but the exact same url with credentials works fine on a browser on the same device and while still on the same network.

Also, again, CORS is not the issue: Obsidian on desktop is also picky when it comes to CORS, and it is working fine - this proves to me that neither the proxy configuration, nor the CORS configuration, nor any other couchdb configuration could be the problem. Also the mobile app acts as if the server is totally unreachable (I think) so it doesn't even have a chance yet to report any CORS error, because for that it needs to "see" the server first.

from obsidian-livesync.

vrtmrz avatar vrtmrz commented on July 17, 2024

Oh, I beg your pardon! I had forgotten some!

If we cannot get a connection even though setting it up with HTTPS, we need to check what errors you're actually getting in DevTools. (It is opaque to Obsidian and Self-hosted LiveSync). Could you please check the log of DevTools on Android?
Remote debug Android devices might be useful. (Also our DevTools guide is here).

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

Could you (also) add more details to the regular log please? Asking users to install developer tools is okay(-ish) for now, but should not be neccesary going forward, after having solved this issue.

from obsidian-livesync.

slonoed avatar slonoed commented on July 17, 2024

Hello. Sorry for a question rather than a feedback, but did anyone get success running HTTPS with self-signed certificate on server and adding self-signed root certificate to trusted on IOS?

I'm using this plugin to sync with my DMZ network and I don't want to use public certificate authorities. Self-signer root+server is working for other things but I don't know if it would work for live sync.

UPDATE
IOS version works perfectly with self-signed certificate if root certificate is trusted on device.

from obsidian-livesync.

NerusSkyhigh avatar NerusSkyhigh commented on July 17, 2024

Hi everyone,
as far as I understand the problem with the iOS version is it requires https instead of HTTP. Are you working on a way to keep using HTTP or is there any guide on how to set up https starting from the HTTP version? Thank you in advance!

PS: I'm having the same issue. If you need me to collect some logs or anything else count me in.

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

@slonoed You can use Letsencrypt. But more to the point: it's a totally different issue.

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

So I used the remote debugging tool:

localhost/:1 Access to fetch at 'https://couch.mydomain.nl/obsidian/' from origin 'http://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

So it is a CORS issue. Well then.

  1. Why did this start happening "suddenly"?
  2. Why does this NOT occur on desktop, which also requires CORS to be enabled?
  3. Why is the origin http://localhost? This needs to be a recognisable identifier.

3 is probably what answers 2, and it is probably also what's changed from when it used to work.

CORS configuration is like this:
image

Adding localhost here is a security issue, since it would allow website running locally (on anyone's device!) to access the DB.

Not sure if this is a problem in Obsidian or LiveSync, so please collaborate on the solution.

from obsidian-livesync.

vrtmrz avatar vrtmrz commented on July 17, 2024

@thany
Unfortunately, the log of CORS error will not be sent to the Obsidian and LiveSync. Hence we cannot see these on the log dialogue. We have to troubleshoot this with DevTools. Thank you for your cooperation and patience!

Obsidian on each platform uses different CORS origins. From the desktop, it could be app://.... And from the Android, it could be http://localhost. Therefore, we have to add these origins. Please refer to 352 to find out which devices use which Origin.

Adding localhost here is a security issue, since it would allow website running locally (on anyone's device!) to access the DB.
Not sure if this is a problem in Obsidian or LiveSync, so please collaborate on the solution.

This is caused by a specification of Obsidian. And the things which you have pointed out are right. However, they have to access the database with credentials. If they have a credential, they can attack the remote database even if we do not allow CORS by using their terminal. CouchDB can respond to the API request which has no CORS headers. Therefore, If they can launch the server using localhost, they might be able to attack.

It is better to hide the endpoints by a longer subdomain or subdirectory and keep the credentials secure.

from obsidian-livesync.

thany avatar thany commented on July 17, 2024

As for the part where it identifies the mobile app as http://localhost, do you think it makes sense to escalate it to an issue in the mobile Obsidian app? I'll happily open an issue there, but I'm not sure if that's where the issue actually originates.

To clarify, the issue is that is should identify with something... identifyable πŸ™‚ Preferably the same as the desktop app, but at least not a universal kind of url that could be anything.

Btw, I guess you're right in that CORS can also be not used at all by an attacker. I didn't think of that.

from obsidian-livesync.

vrtmrz avatar vrtmrz commented on July 17, 2024

This is just my opinion, but it is worth reporting to the Obsidian team.

However, as you mentioned, this will be a comprehensive topic. Not only the specific for (or at) the plug-in problem.
All requests using fetch have an origin header, such as the one from this plugin. Thus, some remote services possibly deny these origins.

from obsidian-livesync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.