Making API call from serverless function. Locally the call returns correct, in production i'm getting duplicate results. Notice the ID on the items array for the first and last item.
{kind: "calendar#events", etag: ""p33gan841gmfv00g"", summary: "DFW Nets",…}
accessRole: "owner"
defaultReminders: []
etag: "\"p33gan841gmfv00g\""
items: [,…]
0: {kind: "calendar#event", etag: ""3238943100952000"", id: "7e5jjq2eos56vn0dsrcr3bgbod_20210428T233000Z",…}
1: {kind: "calendar#event", etag: ""3238991623418000"", id: "0b02a4ik62avudben41ec3bmfs_20210429T033000Z",…}
2: {kind: "calendar#event", etag: ""3238946501106000"", id: "7p37af8hkuli5htepdmu5t6qf4_20210429T170000Z",…}
3: {kind: "calendar#event", etag: ""3238943100952000"", id: "7e5jjq2eos56vn0dsrcr3bgbod_20210429T233000Z",…}
kind: "calendar#events"
summary: "DFW Nets"
timeZone: "America/Chicago"
updated: "2021-04-27T18:20:12.780Z"
code in the serverless function
calendar.events.list({
auth: oAuth2Client,
calendarId: "8pv1frn7h2ml914el8cu7gb9a0@group.calendar.google.com",
singleEvents: true,
showDeleted: false,
timeMin: today.toISOString(),
maxResults: 10,
timeMax: tomorrow.toISOString(),
orderBy: "startTime"
},
(error, response) => {
if (error) {
console.log(error);
return;
}
callback(null, {
headers: {
"Access-Control-Allow-Origin": "*"
},
statusCode: 200,
body: JSON.stringify(response.data)
});
}
); };
to add to this, there are actually missing results as well in this production environment. API explorer is also returning correct results same as development. The issue is just in the bundled code hosted at netlify
note: the timeMin and timeMax are both in the correct format. if i don't include timeMax - the results seem to display correctly?