-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I see this error in the netlify logs:
Aug 19, 09:15:37 AM: cf27b3d6 INFO UpdatePromises at time of return: [
Promise {
<rejected> TypeError: event.attendees is not iterable
at addAttendeeToEvent (/var/task/.cache/functions/signup-submit.js:242512:34)
at updateEventRequest (/var/task/.cache/functions/signup-submit.js:242535:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /var/task/.cache/functions/signup-submit.js:242571:58
at async Promise.allSettled (index 0)
}
]
Looking at the code, we have this:
sync function addAttendeeToEvent(api, calendarId, event, email, addForReal) {
console.log(`Adding attendee to `, event.id, event.start, event.summary, addForReal)
const newAttendees = [
...event.attendees,
{
email: email,
},
]
const eventId = event.id
if (addForReal) {
return await updateAttendees(api, calendarId, eventId, newAttendees)
}
}
However, if a master event doesn't have attenedees, the event.attendees property is not set. You would have thought it would be an empty array, but it isn't, so we need to add a guard here
Metadata
Metadata
Assignees
Labels
No labels