GAS-ICS-Sync icon indicating copy to clipboard operation
GAS-ICS-Sync copied to clipboard

TypeError: Cannot read property 'iterator' of null

Open fizzfaldt opened this issue 4 years ago • 3 comments

I get the following error/stack trace when trying to sync a company holiday/days off calendar:

Error	TypeError: Cannot read property 'iterator' of null
    at checkSkipEvent(Helpers:442:24)
    at createEvent(Helpers:251:27)
    at processEvent(Helpers:193:18)
    at [unknown function](Code:181:9)
    at startSync(Code:180:15)

(Probably not helpful but just in case, included screenshot of the above stack trace) GCS-Stack-Trace

I have not used this particular ICS feed url with GAS-ICS-Sync before but I have used others successfully. This particular ICS feed url works perfectly fine with Google Calendar directly (except of course Google calendar is terrible about updating which is why I'm using GAS-ICS-Sync)

I've verified I'm running the newest version:

var thisVersion = 5.5;

The ICS link is available (it's a public benefits calendar so original link is included), but the saved output ICS is at https://pastebin.com/u6nxqPTF

My settings (removed comments, and marked which booleans are not default settings)

var sourceCalendars = [
  ["https://benefits.vmware.com/?plugin=all-in-one-event-calendar&controller=ai1ec_exporter_controller&action=export_events&no_html=true&ai1ec_cat_ids=1870&lang=en", "VMwareCompanyHolidays"],
];

var howFrequent = 15;
var onlyFutureEvents = true; // NOT DEFAULT
var addEventsToCalendar = true;
var modifyExistingEvents = true;
var removeEventsFromCalendar = true;
var addAlerts = false; // NOT DEFAULT
var addOrganizerToTitle = false;
var descriptionAsTitles = true; // NOT DEFAULT
var addCalToTitle = false;
var addAttendees = false;
var defaultAllDayReminder = -1;

var addTasks = false;

var emailSummary = false;
var email = "[email protected]"; // NOT DEFAULT

fizzfaldt avatar Jan 18 '21 23:01 fizzfaldt

First off, this seems to only be related to using onlyFutureEvents = true so as a workaround you can try turning that off.

Second, it seems to be due to this event:

BEGIN:VEVENT
UID:[email protected]
CATEGORIES;LANGUAGE=us:AMER\,APJ\,Argentina\,Armenia\,Australia\,Austria\,B
 elgium\,Brazil\,Bulgaria\,Canada\,Chile\,China\,Colombia\,Costa Rica\,Denma
 rk\,Egypt\,EMEA\,France\,Germany\,Hong Kong\,India\,Indonesia\,Ireland\,Isr
 ael\,Italy\,Japan\,Korea\,Malaysia\,Mexico\,Netherlands\,New Zealand\,Norwa
 y\,Philippines\,Poland\,Russia\,Saudi Arabia\,Singapore\,South Africa\,Spai
 n\,Sweden\,Switzerland\,Taiwan\,Thailand\,Turkey\,UAE\,United Kingdom\,Unit
 ed States
CONTACT:
DESCRIPTION:EPIC2 Year End Shutdown
DTSTART;VALUE=DATE:20201228
DTEND;VALUE=DATE:20201229
RDATE:20201228T000000Z
RDATE:20201229T000000Z
RDATE:20201230T000000Z
RDATE:20201231T000000Z
RDATE:20210101T000000Z
SEQUENCE:0
SUMMARY:EPIC2 Year End Shutdown
URL:https://benefits.vmware.com/event/epic2-year-end-shutdown/
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//E
 N'>\\n<HTML>\\n<HEAD>\\n<TITLE></TITLE>\\n</HEAD>\\n<BODY><p>EPIC2 Year End
  Shutdown</p>\n</BODY></HTML>
END:VEVENT

This event has some RDATE values, but no indication of recurrence otherwise - yet icalEvent.isRecurring() is returning true. Likely an issue with ical.js. @jonas0b1011001 since you're working on recurring events, anything to weigh in?

derekantrican avatar Jan 19 '21 00:01 derekantrican

Try using Helpers.gs from this branch, should actually be fixed.

jonas0b1011001 avatar Jan 19 '21 05:01 jonas0b1011001

First off, this seems to only be related to using onlyFutureEvents = true so as a workaround you can try turning that off.

I can confirm that workaround does work (allows the ICS to load properly), however it's a problem cause my other ICS is HUGE and I don't want past events (and can't control past events separately for different ICS files).

Try using Helpers.gs from this branch, should actually be fixed.

Can confirm that Helpers.gs from the branch you linked works (and then I no longer need the workaround of onlyFutureEvents = true).

Do you want this issue closed, or wait for the issue to make it to main and/or release?

fizzfaldt avatar Jan 19 '21 07:01 fizzfaldt