question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google Calendar Events List not returning an object

See original GitHub issue

Hello,

I’m trying to get a list of events from the Calendar api. Specifically the calendar.events.list api. On the https://developers.google.com/calendar/v3/reference/events/list it states that it should return events from the calendar. When using the base code from the quickstart https://developers.google.com/calendar/quickstart/nodejs it works perfectly. But i want the listEvents function to return an object and not just console out the events. So when i change the listEvents function from

  const calendar = google.calendar({version: 'v3', auth});
  calendar.events.list({
    calendarId: 'primary',
    timeMin: (new Date()).toISOString(),
    maxResults: 10,
    singleEvents: true,
    orderBy: 'startTime',
  }, (err, res) => {
    if (err) return console.log('The API returned an error: ' + err);
    const events = res.data.items;
    if (events.length) {
      console.log('Upcoming 10 events:');
      events.map((event, i) => {
        const start = event.start.dateTime || event.start.date;
        console.log(`${start} - ${event.summary}`);
      });
    } else {
      console.log('No upcoming events found.');
    }
  });
}

to

  const calendar = google.calendar({version: 'v3', auth});
  const results = calendar.events.list({
    calendarId: 'primary',
    timeMin: (new Date()).toISOString(),
    maxResults: 10,
    singleEvents: true,
    orderBy: 'startTime',
  });
console.log(results);
}

results is just undefined. Am i missing something? Thanks in advanced.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
ericpakcommented, Aug 18, 2018

Fixed the error. The quickstart says to use npm install googleapis@27 --save but after uninstalling it and using the most recent version it works.

The quickstart should be updated to say npm install googleapis --save instead of @27

0reactions
ericpakcommented, Feb 1, 2021

@ericpak i am doing it in inline ediditor of dialogflow, and having the same error, can anyone help me solve this?

Hi @Smarto-Dev, Sorry for the late reply. If you’re still having issues I’d be happy to help. I solved my issue by using the updated googleapis instead of the version listed in the quickstart.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google calendar API do not return events list - Stack Overflow
Same problem here. A secondary calendar with plenty of recurring events (visible in web GUI) but using python API, events().list() does NOT ......
Read more >
Events | Google Calendar
Property name Value Notes anyoneCanAddSelf boolean writable attachments list attachments.fileId string
Read more >
Google Calendar API events list does not return al...
I have some python script that calls Google Calendar API events list with start and end set. It seems that there is an...
Read more >
calendar.events.list - Calendar | AnyAPI Documentation
Once this feature is shutdown, the API will no longer return reminders using this method. Any newly added SMS reminders will be ignored....
Read more >
events() - Google APIs
Returns an event based on its Google Calendar ID. To retrieve an event using its iCalendar ID, call the events.list method using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found