I have a Google Apps Script which uses a JSON web API to get a list of StarCraft2 tournaments from a site (using UrlFetchApp) and create corresponding Google Calendar events in a variety of Calendars (one Calendar per region/league combination).
I have a trigger set to every 5 minutes, that emails me immediately on errors, and if the script completes normally and has added any events or run into any errors I caught, it emails me as well.
Most of the time, there are no changes necessary (I cache the JSON info using ScriptDb to avoid calling out to CalendarApp unless I need to) and the script is silent. However, overnight I received several emails which contained the messages:
The resource you requested could not be located. (line 154) Service error: CalendarApp: Error body {font-family: arial,sans-serif} G o o g l e Error Cannot access the calendar you requested (line 155) TypeError: Cannot call method "getEvents" of null. (line 155)
Lines 154, 155 and 156 are:
var calendar = CalendarApp.getCalendarById(calendars[region][league]); var events = calendar.getEvents(new Date(1900, 1, 1), new Date()); events.forEach(function (event) { event.deleteEvent(); });
At this point in the script I've already attempted to add any new events and I'm about to query each of my Calendars to delete any events which occurred in the past.
These errors appear to be an issue with the availability of CalendarApp, but the Dashboard does not indicate any issues with the service.
My project key is: MWhWmFSrL1dK3RJui6Aphb12cA4KNgw7R