Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Getting Error if user tries to connect another Google account. #565

Open
sandhiyakavi opened this issue Nov 1, 2021 · 5 comments
Open

Comments

@sandhiyakavi
Copy link
Collaborator

Description:

Getting Error ""Failed to connect calendar: coud not find any writable calendar"" if user tries to connect another Google account .
Steps to Reproduce:

  1. Connect a Google account to the user. (Google account: [email protected])
  2. Without removing the account, try to connect another Google account. ([email protected])

api: GET/taas-teams/user-meeting-settings/71c5e6a8-51d9-4fb5-91ce-d974642531af

calendar_error

@maxceem
Copy link
Contributor

maxceem commented Nov 5, 2021

Sum up:

  • As per debugging and clarifying with Nylas this happens for all accounts when they connect to Nylas the first time. It takes time from Nylas to sync calendars, so after we connect account first time it might take up to 20 seconds for Nylas to sync (as per Nylas support response).
  • So to fix this issue we have to improve logic which handles calendar connection https://github.com/topcoder-platform/taas-apis/blob/dev/src/services/UserMeetingSettingsService.js#L280-L289
    • If we cannot find any writable calendar using NylasService.getExistingCalendars + NylasService.getPrimaryCalendar
    • we have to make pause (5 seconds) and try getting writable calendar again NylasService.getExistingCalendars + NylasService.getPrimaryCalendar
    • we have to try it again and again until we reach maximum retry time (20 seconds)
  • Make delay between attempts (5 seconds) and maximum time (20 seconds) configurable using env variables.

@maxceem maxceem added the CF label Nov 5, 2021
@maxceem maxceem added this to the Interview Update (Nylas) milestone Nov 5, 2021
@maxceem
Copy link
Contributor

maxceem commented Nov 26, 2021

I've implemented a retry policy during 30 seconds as recommended by Nylas support topcoder-platform/taas-apis@b780c89, but it didn't help. Even 30 seconds is not enough, while Nylas support recommended to wait up to 20 seconds, see log:

[2021-11-25T15:34:15.429Z] NylasService getAccessToken DEBUG : input arguments: { code: 'XXX' }
[2021-11-25T15:34:15.898Z] NylasService getAccessToken DEBUG : output arguments: { accountId: '22rsvnmpboum0sg7ghleopu0c', accessToken: 'XXX', provider: 'eas', email: '[email protected]' }
[2021-11-25T15:34:15.898Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:16.112Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:16.112Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:16.112Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:16.113Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:16.113Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:17.113Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:17.336Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:17.336Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:17.336Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:17.336Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:17.336Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:18.537Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:18.751Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:18.751Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:18.751Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:18.751Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:18.752Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:20.193Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:20.420Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:20.421Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:20.421Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:20.421Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:20.421Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:22.150Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:22.678Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:22.678Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:22.678Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:22.678Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:22.678Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:24.753Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:24.994Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:24.995Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:24.995Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:24.995Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:24.995Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:27.485Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:27.943Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:27.943Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:27.943Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:27.944Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:27.944Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:30.930Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:31.158Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:31.158Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:31.158Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:31.159Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:31.159Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:34.742Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:34.964Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:34.964Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:34.964Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:34.964Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:34.964Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:39.268Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:39.491Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:39.491Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:39.491Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:39.491Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar
[2021-11-25T15:34:39.491Z] InterviewService getConnectedCalendarWithRetry DEBUG : trying to get connected calendar again...
[2021-11-25T15:34:44.652Z] NylasService getExistingCalendars DEBUG : input arguments: { accessToken: 'eE2PqgRjrtTkPVAkGcTCpQDQB0cf8x' }
[2021-11-25T15:34:44.927Z] NylasService getExistingCalendars DEBUG : output arguments: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ]
[2021-11-25T15:34:44.927Z] NylasService getPrimaryCalendar DEBUG : input arguments: { calendars: [ { account_id: '22rsvnmpboum0sg7ghleopu0c', description: 'Emailed events', id: 'a43azcl6wr5buqknxuibd4tfd', is_primary: null, location: null, name: 'Emailed events', object: 'calendar', read_only: true, timezone: null } ] }
[2021-11-25T15:34:44.927Z] NylasService getPrimaryCalendar DEBUG : output arguments: undefined
[2021-11-25T15:34:44.927Z] InterviewService getConnectedCalendarWithRetry DEBUG : did not get connected calendar

@maxceem
Copy link
Contributor

maxceem commented Dec 20, 2021

This was fixed together with #580 and #588 and ready for QA.

@sdgun
Copy link

sdgun commented Dec 21, 2021

Verified in dev env, issue is fixed.

multiple.emails.mp4

@sdgun
Copy link

sdgun commented Apr 5, 2022

Removing the milestone since this feature was disabled in the current production release #598

@sdgun sdgun removed this from the Interview Update (Nylas) milestone Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants