El Odve
El Odve
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
Thanks! The least amount of coding I've done to get something working... 😄
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
@Guillaume: Don't know why, but rebuilt with 0.53.2, patched the two files in question within the container and restarted and NOW it works. 😄
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
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
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
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
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
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
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
So essentialy you're right, it is an unauthorized error. For me the simplest workaround would be to be able to set a TENANT_ID variable in the config which has the default value common
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
Do you have any plans to support single tenant applications?
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
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
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
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
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
😆 Will do!
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
...that makes two of us...
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
I tested the refreshToken using Postman yesterday, and the token itself seemed fine. Could there be some security setting company wide in Azure that breaks this?
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
No description
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
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
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
Thanks! I really want to get to the bottom of this. 🙂 Loving Twenty CRM so far, just need to get this bit sorted and it will be perfect for our purposes!
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
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
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
How/where do I do that?
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
I've set up all the required permissions in azure, the secret is valid, application ID is fine and redirect URIs work.
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
That's right.
66 replies
TTwenty
Created by El Odve on 5/7/2025 in #❓︱help
Microsoft sync works, only it doesn't... (multi-tenant)
No, it's a corporate account.
66 replies