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

400 Bad Request when uploading a calendar (TypeError: can't compare offset-naive and offset-aware datetimes) #925

Closed
cpitclaudel opened this issue Feb 10, 2019 · 7 comments
Labels
dependency:dateutil external dependency "dateutil" related dependency:vobject external dependency "vobject" related need:reporter feedback feedback from reporter required not our bug issues which can't be fixed on server side

Comments

@cpitclaudel
Copy link

Thanks for the hard work on Radicale!

I saw the closed issue at #806, but I'm running into this issue despite upgrading to the latest radicale (2.1.11). I exported my Gmail calendar to ICS, and when using curl to upload it to Radicale I see get a 'bad request' response. The log says this:

Feb 10 17:46:34 raspi env[1326]: BEGIN:VEVENT
Feb 10 17:46:34 raspi env[1326]: CREATED:20100713T145922Z
Feb 10 17:46:34 raspi env[1326]: LAST-MODIFIED:20190210T151327Z
Feb 10 17:46:34 raspi env[1326]: DTSTAMP:20190210T151327Z
Feb 10 17:46:34 raspi env[1326]: UID:040000008200E00074C5B7101A82E00800000000000000002F6DF480DC3E534DBA44DA
Feb 10 17:46:34 raspi env[1326]:  50F42BCF512F6DF480DC3E534DBA44DA50F42BCF51
Feb 10 17:46:34 raspi env[1326]: SUMMARY:Maths
Feb 10 17:46:34 raspi env[1326]: STATUS:CONFIRMED
Feb 10 17:46:34 raspi env[1326]: DTSTART;TZID=America/New_York:20080203T040000
Feb 10 17:46:34 raspi env[1326]: DTEND;TZID=America/New_York:20080203T050000
Feb 10 17:46:34 raspi env[1326]: X-LIC-ERROR:No value for LOCATION property. Removing entire property:
Feb 10 17:46:34 raspi env[1326]: SEQUENCE:0
Feb 10 17:46:34 raspi env[1326]: TRANSP:OPAQUE
Feb 10 17:46:34 raspi env[1326]: END:VEVENT
Feb 10 17:46:34 raspi env[1326]: BEGIN:VEVENT
Feb 10 17:47:09 raspi env[1326]: [7601d470] WARNING: Bad PUT request on '/clement/4cf4ec72-8df4-8b1d-9608-ce8e09b30cc1/': Failed to store item '653243a0-5af3-d18e-5ca8-70f48e4c5f16.ics' in temporary collection 'clement/4cf4ec72-8df4-8b1d-9608-ce8e09b30cc1': can't compare offset-naive and offset-aware datetimes
Feb 10 17:47:09 raspi env[1326]: Traceback (most recent call last):
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/radicale/storage.py", line 1045, in _upload_all_nonatomic
Feb 10 17:47:09 raspi env[1326]:     cache_content = self._item_cache_content(vobject_item)
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/radicale/storage.py", line 1298, in _item_cache_content
Feb 10 17:47:09 raspi env[1326]:     tag, start, end = xmlutils.find_tag_and_time_range(vobject_item)
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/radicale/xmlutils.py", line 688, in find_tag_and_time_range
Feb 10 17:47:09 raspi env[1326]:     _visit_time_ranges(vobject_item, tag, range_fn, infinity_fn)
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/radicale/xmlutils.py", line 359, in _visit_time_ranges
Feb 10 17:47:09 raspi env[1326]:     for dtstart in dtstarts:
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/dateutil/rrule.py", line 1400, in _iter
Feb 10 17:47:09 raspi env[1326]:     while exlist and exlist[0] < ritem:
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/dateutil/rrule.py", line 1337, in __lt__
Feb 10 17:47:09 raspi env[1326]:     return self.dt < other.dt
Feb 10 17:47:09 raspi env[1326]: TypeError: can't compare offset-naive and offset-aware datetimes
Feb 10 17:47:09 raspi env[1326]: The above exception was the direct cause of the following exception:
Feb 10 17:47:09 raspi env[1326]: Traceback (most recent call last):
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/radicale/__init__.py", line 935, in do_PUT
Feb 10 17:47:09 raspi env[1326]:     path, items, props)
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/radicale/storage.py", line 1006, in create_collection
Feb 10 17:47:09 raspi env[1326]:     self._upload_all_nonatomic(vobject_items)
Feb 10 17:47:09 raspi env[1326]:   File "/usr/local/lib/python3.5/dist-packages/radicale/storage.py", line 1050, in _upload_all_nonatomic
Feb 10 17:47:09 raspi env[1326]:     (href, self.path, e)) from e
Feb 10 17:47:09 raspi env[1326]: ValueError: Failed to store item '653243a0-5af3-d18e-5ca8-70f48e4c5f16.ics' in temporary collection 'clement/4cf4ec72-8df4-8b1d-9608-ce8e09b30cc1': can't compare offset-naive and offset-aware datetimes
Feb 10 17:47:09 raspi env[1326]: [7601d470] DEBUG: Running hook
Feb 10 17:47:09 raspi env[1326]: [7601d470] DEBUG: Response content:
Feb 10 17:47:09 raspi env[1326]: Bad Request
Feb 10 17:47:09 raspi env[1326]: [7601d470] INFO: PUT response status for '/clement/4cf4ec72-8df4-8b1d-9608-ce8e09b30cc1/' in 35.914 seconds: 400 Bad Request

Is there a problem on my side? Thanks a lot!

@abrock
Copy link

abrock commented Apr 27, 2024

I'm using Thunderbird for calendar and everything works as expected, except for recurring events that are created by MS Teams. I accept the invitations, the events show up, and I get reminders, but when I try to dismiss the reminders I get the error message:

[2024-04-27 21:09:49 +0200] [39387/Thread-26 (process_request_thread)] [WARNING] Bad PUT request on '/alexander/6951ee21-e875-b082-faee-587f46c94fee/040000008200E00074C5B7101A82E00800000000A8C425F0E076DA010000000000000000100000003C3D49C0CB72B8479165DBB57A349ADC.ics': can't compare offset-naive and offset-aware datetimes
[2024-04-27 21:09:49 +0200] [39387/Thread-26 (process_request_thread)] [INFO] PUT response status for '/alexander/6951ee21-e875-b082-faee-587f46c94fee/040000008200E00074C5B7101A82E00800000000A8C425F0E076DA010000000000000000100000003C3D49C0CB72B8479165DBB57A349ADC.ics' in 0.025 seconds: 400 Bad Request

I can delete the events, but only if I delete all occurrences which is not very useful.
How can I produce the necessary data for helping to debug this?

@pbiering pbiering added the dependency:vobject external dependency "vobject" related label Apr 27, 2024
@pbiering
Copy link
Collaborator

can you enable debugging to catch the content of the event during upload? Then one has to investigate why "vobject" don't like it.

@abrock
Copy link

abrock commented Apr 27, 2024

I ran radicale with -D and copied the lines that are printed when I click "Dismiss" in Thunderbird.
Is this what you had in mind? I replaced all personal information except my name by "REDACTED".

radicale-debugging-data.txt

@pbiering
Copy link
Collaborator

pbiering commented May 3, 2024

this is related to #1478 and a bug in "dateutil"

@pbiering pbiering added not our bug issues which can't be fixed on server side dependency:dateutil external dependency "dateutil" related labels May 3, 2024
@WiredWonder
Copy link

Another user facing this bug (same root cause, recurring MS Teams meeting).

@pbiering
Copy link
Collaborator

which version of dateutil is currently used and can one try to use a newer one from here to check whether the issue is fixed meanwile: https://pypi.org/project/python-dateutil/#history

@pbiering pbiering added the need:reporter feedback feedback from reporter required label Nov 30, 2024
@pbiering
Copy link
Collaborator

closing as no feedback, please reopen if still a problem with latest version of radicale and vobject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency:dateutil external dependency "dateutil" related dependency:vobject external dependency "vobject" related need:reporter feedback feedback from reporter required not our bug issues which can't be fixed on server side
Projects
None yet
Development

No branches or pull requests

4 participants