nylas / sync-engine

:incoming_envelope: IMAP/SMTP sync system with modern APIs
https://nylas.com/docs/platform
GNU Affero General Public License v3.0
3.5k stars 354 forks source link

Calendar events are sometimes missing from incoming messages #247

Open raindrift opened 8 years ago

raindrift commented 8 years ago

Incoming messages have the events array, containing attached calendar events. Sometimes, when an iCalendar file is attached to a message, the events are set properly. Other times, events is blank. This is true in the delta stream, or if the message is re-fetched from the API later.

We can reproduce by sending the same .ics file as an attachment many times. It works sometimes and not others. There doesn't seem to be anything that can predict it.

Here is a sample .ics that we've been using to test:

BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Pacific Standard Time
BEGIN:STANDARD
DTSTART:16010101T020000
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
ORGANIZER;CN=Marc Blinder:MAILTO:marc@emmerge.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Ashlee Cha
 rette:MAILTO:ashlee@emmerge.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Colin McCl
 oskey:MAILTO:colin@emmerge.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Mark Lanet
 t:MAILTO:mlanett@emmerge.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Jeff Feldm
 an:MAILTO:jeff@emmerge.com
UID:FD2AA5B4-2AB6-4C07-82DE-6158BBABB70C
SUMMARY;LANGUAGE=en-US:Super secret team feature design session
DTSTART;TZID=Pacific Standard Time:20160106T150000
DTEND;TZID=Pacific Standard Time:20160106T170000
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20160106T013606Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:3
X-MICROSOFT-CDO-APPT-SEQUENCE:3
X-MICROSOFT-CDO-OWNERAPPTID:2113725996
X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INSTTYPE:0
X-MICROSOFT-DISALLOW-COUNTER:FALSE
END:VEVENT
END:VCALENDAR

We have verified that this sample data parses correctly with the icalendar python module, and that the relevant sync engine code (inbox/events/ical.py) can extract valid data from the parsed result.

mccolin commented 8 years ago

We have been able to attach and send invites that fail on a first import in subsequent emails and see them successfully import, proving the success/failure is not predictable.

mccolin commented 8 years ago

Received a note from the Nylas team that may be related: "We've identified a potential cause for the issue. It appears that if a message has an attached invitation and was sent by the account owner, then we aren't creating an event object for it."