El Odve
Microsoft sync works, only it doesn't... (multi-tenant)
Exception Captured
{ workspace: { id: '2fa67d60-5c17-4a6e-becd-2e70f4434d81' } }
[
CalendarEventImportDriverException [Error]: Access token is undefined or empty. Please provide a valid token.For more help - https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/CustomAuthenticationProvider.md
at parseMicrosoftCalendarError (/app/packages/twenty-server/dist/src/modules/calendar/calendar-event-import-manager/drivers/microsoft-calendar/utils/parse-microsoft-calendar-error.util.js:31:20)
at MicrosoftCalendarGetEventsService.getCalendarEvents (/app/packages/twenty-server/dist/src/modules/calendar/calendar-event-import-manager/drivers/microsoft-calendar/services/microsoft-calendar-get-events.service.js:42:84)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async CalendarFetchEventsService.fetchCalendarEvents (/app/packages/twenty-server/dist/src/modules/calendar/calendar-event-import-manager/services/calendar-fetch-events.service.js:43:47)
at async CalendarEventListFetchJob.handle (/app/packages/twenty-server/dist/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.js:53:17)
at async MessageQueueExplorer.invokeProcessMethods (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:111:17)
at async MessageQueueExplorer.handleProcessor (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:103:13)
at async /app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:79:17
at async Worker.processFn (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/drivers/bullmq.driver.js:41:13)
at async /app/node_modules/bullmq/dist/cjs/classes/worker.js:520:32 {
code: 'UNKNOWN'
}
]
66 replies
Microsoft sync works, only it doesn't... (multi-tenant)
Hmmm... There's something else going on as well. I know get an error when importing calendar events, which claims the access token is undefined or empty. When replicating the relevant call from the code manually using the values from the connectedAccount table in the database (which is now successfully populated), I get a valid response including a new accessToken.
66 replies
Microsoft sync works, only it doesn't... (multi-tenant)
For me it would probably be easiest to make a clone, I think. At least there I now know what I need to do. 🙂 Fixing the permissions in Azure is more of an unknown at this point... 😉 Is there more magic to supporting single tenant than having a MICROSOFT_TENANT_ID env variable that is set to 'common' by default and using this value in the url used to fetch the access tokens? I see it is used in two files, packages/twenty-server/src/modules/connected-account/oauth2-client-manager/drivers/microsoft/microsoft-oauth2-client-manager.service.ts and packages/twenty-server/src/modules/connected-account/refresh-tokens-manager/drivers/microsoft/services/microsoft-api-refresh-tokens.service.ts
66 replies
Microsoft sync works, only it doesn't... (multi-tenant)
I think I'm getting to the root of this now. The accessToken field in the database is blank. Am I correct in assuming that you use the common access point in OAUTH? I haven't seen any place I can specify the tenant id, so I think that is a safe assumption? If I try to obtain an accessToken manually using curl and the common tenant then this is indeed currently blocked by conditional access. If I try using our tenant ID, I can get the access token without any issues.
66 replies
Microsoft sync works, only it doesn't... (multi-tenant)
BTW, do you keep the response body from the Microsoft Graph API in the logs somewhere so I can look there? If not, I'll try to replicate the call that fails once I locate it in the source code.
66 replies
Microsoft sync works, only it doesn't... (multi-tenant)
Here is a fresh error log from worker-1 upon failed import. This crashed the Connected Accounts service, which then takes a few minutes to get back up.
Exception Captured
undefined
[
'Unknown error importing messages for message channel 5f45fdcb-a6d6-4f32-9be8-8a426d5c18bd in workspace 2fa67d60-5c17-4a6e-becd-2e70f4434d81: Request failed with status code 401'
]
Exception Captured
undefined
[
MessageImportException [Error]: Request failed with status code 401
at MessageImportExceptionHandlerService.handleUnknownException (/app/packages/twenty-server/dist/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.js:110:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MessageImportExceptionHandlerService.handleDriverException (/app/packages/twenty-server/dist/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.js:62:17)
at async MessagingMessageListFetchJob.handle (/app/packages/twenty-server/dist/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.js:128:13)
at async MessageQueueExplorer.invokeProcessMethods (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:111:17)
at async MessageQueueExplorer.handleProcessor (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:103:13)
at async /app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:79:17
at async Worker.processFn (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/drivers/bullmq.driver.js:41:13)
at async /app/node_modules/bullmq/dist/cjs/classes/worker.js:520:32
at async Worker.retryIfFailed (/app/node_modules/bullmq/dist/cjs/classes/worker.js:747:24) {
code: 'UNKNOWN'
}
]
66 replies
Microsoft sync works, only it doesn't... (multi-tenant)
@Guillaume: I figured out how to test this using Postman, and the refreshToken as copied from the database is valid. Something else is amiss. Could you point me to where in the source code you create the connection? With a bit of luck I might be able to debug something better then.,..
66 replies