pimutils / vdirsyncer

📇 Synchronize calendars and contacts.
https://vdirsyncer.pimutils.org/
Other
1.57k stars 163 forks source link

Connection with NextCloud-Server fails #1009

Open Alex-Dall opened 2 years ago

Alex-Dall commented 2 years ago

Hello, I can not connect to my Nextcloud-Server.

vdirsyncer version: 0.18.0 in Docker Image (https://registry.hub.docker.com/r/bleala/vdirsyncer/) Nextcloud 22

Config-File

[...]

[pair calendar]
a = "google"
b = "nextcloud"

collections = ["from a", "from b"]

[...]

[storage nextcloud]
type = "caldav"
url = "https://*****/remote.php/dav/"
username = "*****"
password = "******"

Output when I run vdirsyncer -vdebug discover

[...]
debug: ====================
debug: PROPFIND https://*****/remote.php/dav/
debug: {'User-Agent': 'vdirsyncer/0.18.0', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '1'}
debug: b'\n    <propfind xmlns="DAV:">\n        <prop>\n            <resourcetype />\n        </prop>\n    </propfind>\n    '
debug: Sending request...
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 218, in _print_collections
debug:     discovered = get_discovered()
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 142, in get_self
debug:     return self._discovered
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/utils.py", line 169, in __get__
debug:     obj.__dict__[self.__name__] = result = self.fget(obj)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 151, in _discovered
debug:     return handle_storage_init_error(self._cls, self._config)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 147, in _discovered
debug:     discovered = list(self._cls.discover(**self._config))
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 269, in discover
debug:     for c in self.find_collections():
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 224, in find_collections
debug:     rv = list(self._find_collections_impl(""))
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 251, in _find_collections_impl
debug:     r = self.session.request(
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 397, in request
debug:     return http.request(method, url, session=self._session, **more)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/http.py", line 153, in request
debug:     r = func(method, url, **kwargs)
debug:   File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
debug:     resp = self.send(prep, **send_kwargs)
debug:   File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
debug:     r = adapter.send(request, **kwargs)
debug:   File "/usr/lib/python3.10/site-packages/requests/adapters.py", line 565, in send
debug:     raise ConnectionError(e, request=request)
warning: Failed to discover collections for nextcloud, use `-vdebug` to see the full traceback.
debug: ====================
debug: PROPFIND https://******/remote.php/dav/
debug: {'User-Agent': 'vdirsyncer/0.18.0', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '1'}
debug: b'\n    <propfind xmlns="DAV:">\n        <prop>\n            <resourcetype />\n        </prop>\n    </propfind>\n    '
debug: Sending request...
error: Unknown error occurred: HTTPSConnectionPool(host='*******', port=443): Max retries exceeded with url: /remote.php/dav/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f3957e0acb0>: Failed to establish a new connection: [Errno 111] Connection refused'))
error: Use `-vdebug` to see the full traceback.
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/utils.py", line 348, in _worker
debug:     func(wq=self)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/tasks.py", line 91, in discover_collections
debug:     rv = collections_for_pair(pair=pair, **kwargs)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 79, in collections_for_pair
debug:     rv = list(
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 195, in expand_collections
debug:     b_args = _collection_from_discovered(
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 211, in _collection_from_discovered
debug:     return get_discovered()[collection]
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 142, in get_self
debug:     return self._discovered
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/utils.py", line 169, in __get__
debug:     obj.__dict__[self.__name__] = result = self.fget(obj)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 151, in _discovered
debug:     return handle_storage_init_error(self._cls, self._config)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/cli/discover.py", line 147, in _discovered
debug:     discovered = list(self._cls.discover(**self._config))
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 269, in discover
debug:     for c in self.find_collections():
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 224, in find_collections
debug:     rv = list(self._find_collections_impl(""))
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 251, in _find_collections_impl
debug:     r = self.session.request(
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 397, in request
debug:     return http.request(method, url, session=self._session, **more)
debug:   File "/usr/lib/python3.10/site-packages/vdirsyncer/http.py", line 153, in request
debug:     r = func(method, url, **kwargs)
debug:   File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
debug:     resp = self.send(prep, **send_kwargs)
debug:   File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
debug:     r = adapter.send(request, **kwargs)
debug:   File "/usr/lib/python3.10/site-packages/requests/adapters.py", line 565, in send
debug:     raise ConnectionError(e, request=request)
error: 1 out of 1 tasks failed.

Do I make a mistake or is there a bug? It would be really nice, if somebody could help me.

Kind regards, Alex

WhyNotHugo commented 1 year ago

Looks like the remote server is rejecting the connection.

What do you get when opening https://*****/remote.php/dav/" in the browser?

Alex-Dall commented 1 year ago

Hello, When opening the link in the browser, the browser ask me for Username and Password. After Login the following sentence is written on a white background: This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

WhyNotHugo commented 1 year ago

Odd [Errno 111] Connection refused is a network error (e.g.: the server rejected the TCP connection). This happens before we send the request, so I don't think this is a bug in vdirsyncer.

If you retry, do you see the same error, or maybe a different one?