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

500 Internal Server Error in CalDAV extension with Baikal #111421

Open
update-freak opened this issue Feb 25, 2024 · 13 comments
Open

500 Internal Server Error in CalDAV extension with Baikal #111421

update-freak opened this issue Feb 25, 2024 · 13 comments

Comments

@update-freak
Copy link

The problem

I have the problem that with the CalDAV extension (https://www.home-assistant.io/integrations/caldav/) I got the error "500 Internal Server Error" in the log (see attached file).
In the overview I got the items of the To-Do-list, but the entries from the calanders are emtpy.

HA_log.txt

What version of Home Assistant Core has the issue?

core-2024.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

CalDAV

Link to integration documentation on our website

https://www.home-assistant.io/integrations/caldav/

Diagnostics information

home-assistant_caldav_2024-02-25T21-13-08.720Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Baikal is installed as docker container on a Synology NAS.
Home Assistant is installed as VM on a Synology NAS.
The Reverse Proxy is used to create a URL like this: https://baikal.example.dynv6.net

@home-assistant
Copy link

@TheZoker
Copy link
Contributor

Same issue here. ToDo seems to work, but calendars are not synced as expected with the same error message

@update-freak
Copy link
Author

I guess this error is also related to sabre-io/Baikal#1241

@tobixen
Copy link

tobixen commented Mar 5, 2024

This may be a compatibility issue between the python-caldav library and the baikal server. If you are willing to create a test account for me or share some username/password with me (privately) I may try to look a bit into it.

@TheZoker
Copy link
Contributor

TheZoker commented Mar 5, 2024

@tobixen I can provide you an dev setup if that helps (without any data on it). Would that help? If yes, please let me know, where I can reach you

@tobixen
Copy link

tobixen commented Mar 6, 2024

Yes, as long as the dev setup has the same problems, then it's useful. You can use t-caldav-111421@tobixen.no

@tobixen
Copy link

tobixen commented Mar 6, 2024

I ran the python-caldav test suite towards the baikal server provided, and I'm sorry to say ... that all tests passed. This either means the problem is specific to the Home Assistant caldav integration or that my test code is not able to trigger the problem. (or that the problem is not present on the dev setup, but present on the Synology setup).

(That said, "500 internal server error" should usually mean that there is a problem on the server side, and there should usually be something in the server log about it).

@update-freak
Copy link
Author

I tried it now again with
https://baikal.example.dynv6.net/dav.php and with
http://192.168.178.27:49179/dav.php

I attached the log file from baikal in portainer. Maybe this helps.
error log baikal.txt

@tobixen
Copy link

tobixen commented Mar 7, 2024

(This comment has been updated to squash in my "train of thought" in now deleted following comments)

This is the smoking gun:

2024/03/07 06:00:32 [error] 53#53: *2781 FastCGI sent in stderr: "PHP message: Sabre\VObject\ParseException: This parser only supports VCARD and VCALENDAR files in /var/www/baikal/vendor/sabre/vobject/lib/Parser/MimeDir.php:163

My first thought is that there is something wrong with the icalendar data sent, the server does not recognize it as valid VCALENDAR. However, HomeAssistant is doing a REPORT-query to fetch icalendar data from the server, so that's not the case. Probably there is something specific in the REPORT-query that breaks baikal.

In the next release of the python-caldav library it will be possible to set an environmental variable, and it will dump all the caldav communication to files under /tmp. This will at some point in the future make it easy to extract more debug information from those of us running HomeAssistant in "supervised"-mode on a linux system. Right here and now I think the only solution is to try to get the communication out on the server side. With the http-solution it should be possible to use tcpdump. @update-freak, if you have any chance running tcpdump on 192.168.178.27, then please do. Something like this should catch the whole REPORT-request:

sudo tcpdump -w /tmp/caldav.pcap -I any port 49179

@purche42
Copy link

purche42 commented Mar 8, 2024

This may be a problem which occurs on Baikal docker deployment (ckulka/baikal:nginx) .
I have the same issue with "500 Internal Server Error" with HA CalDAV while Baikal is working fine with several other clients.
I also got the same message : "This parser only supports VCARD and VCALENDAR files"

It looks similar to an older problem described here :
sabre-io/dav#1318 (comment)

this is related to this bug
"There is a bug in upstream Baikal with a timezone that makes Home Assistant unable to read calendars from the server. A solution was developed sabre-io/dav#1318 (comment), but has to be reapplied every time the container restarts or updates."

@update-freak
Copy link
Author

Thanks a lot! Using this docker image from above (sabre-io/dav#1318 (comment)) solved the issue: ghcr.io/mralucarddante/baikal-docker-hass:latest

@N3RO365
Copy link

N3RO365 commented Mar 29, 2024

Thanks a lot! Using this docker image from above (sabre-io/dav#1318 (comment)) solved the issue: ghcr.io/mralucarddante/baikal-docker-hass:latest

Hello.

Can I simply replace the Docker url or do I have to reinstall the Docker and then set everything up again?

@update-freak
Copy link
Author

I simply changed the URL and it worked out of the box. (but as always: save your data first)

Skaronator added a commit to Skaronator/homelab that referenced this issue Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants