hk21702 / YA-GCal-Notion-Sync-Script

Script to synchronize between a Notion database and Google Calendar both ways. Uses Google App Script.
GNU General Public License v3.0
142 stars 11 forks source link

Cannot add new calendar IDs without the process failing ("API call to calendar.events.list failed with error: Sync token is no longer valid, a full sync is required.") #3

Open Etheride opened 2 years ago

Etheride commented 2 years ago

Hello!

I would like to use this script to sync between Notion and GCal however there are issues when I try to add a new calendar ID to CalendarID.js such as the script fails to execute once I add a new Calendar ID as the error "10:13:20 AM Error
Error: API call to calendar.events.list failed with error: Sync token is no longer valid, a full sync is required.". I do not know how to patch this as I am not profficient in JS.

Would it be possible for you to add me on discord as I would like help with another issue :P ether#9925

The Stack Trace is

Error: API call to calendar.events.list failed with error: Sync token is no longer valid, a full sync is required.
syncFromGCal    @ main.gs:143
main    @ main.gs:30

The calendar ID constants is below


  /* Add calendars here. 
  The key (string before ':') is what you name the calendar. 
  The value (string after ':') is the calendar ID. 
  E.g. "My calendar name"]: "mycalendarid", */
  ["Primary"]: "primary",
  ["Birthdays"]: "addressbook#contacts@group.v.calendar.google.com",
};
hk21702 commented 2 years ago

I was able to replicate this issue. The birthday calendar you're using seems to be one of the autogenerated ones made by Google. I'll look into how to handle it later when I can, but from initial testing it seems like for some reason these kinds of calendars are treated differently by the Google Calendar API.

Etheride commented 2 years ago

The same thing occurs with Google Classroom's calendar as well

hk21702 commented 2 years ago

Yea, it seems like any of the auto generated calendars such as birthdays or public holidays won't work. It's not even the fact that the calendar is read only since the call fail is just at trying to list all the events in the calendar. This might be a limitation of the API itself to be honest unfortunately. I'm not sure about the case for Google Classroom's calendar. That may also count as an auto generated calendar, but I haven't checked for myself.

hikarizun commented 1 year ago

Hi! I've been using this script and it worked fine for the past month. But recently I've been getting this same error message:

Error: API call to calendar.events.list failed with error: Sync token is no longer valid, a full sync is required. syncFromGCal @ main.js.gs:183 main @ main.js.gs:38

I only have very rudimentary knowledge of coding, so I don't know how to perform this full sync. Hope you can assist!

hk21702 commented 1 year ago

@hikarizun Please look at #45. In the future, please don't comment on unrelated issue threads and instead make a new issue.