Email sync failed - self hosted
Hi everyone. I did a self host of Twenty and tried setting up email sync. But it's giving me error "sync failed" however, I see people and companies creates out of my email account. Is there a way to debug the sync jobs? Running everything in a docker-compose.
24 Replies
@Guillaume could you take a look?
Hi @hassaanz , Thanks for setting up Twenty.
Did you launch the worker app ? they are the one repsonsible of treating emails.
My bad, if you see people created from your emails it means workers are on and working.
If you look at the worker logs, do you see any errors ?
Also make sure you are using the latest version of twenty since we did a coupld of fix that are available on the main branch
Hi, I am getting the same error, email is syncing for about 1-2 days before hitting a sync failed. Is there a way to restart or can you only remove the account and start again?
I have some logs but there is a lot of personal data in them. Let me know what you require and can send in
are you o microsoft of google guys ?
Microsoft
ok. we are aware of a bug. right now working on it. I'll keep you in touch in the coming days
Excellent thanks
Hi. Sorry for the late reply. I tried to update to the latest version. I have my worker app running. There are some emails synced but it seems like the job is stuck in between. The admin panel health status shows everything is working fine.
For some reason the calendar sync seems to be working but the emails are not being synced

Hey everybody 🙂 I'm hosting Twenty on a Digital Ocean VPS and everything works fine, except of the mail sync. I'm trying to sync google workspace mails and it directly throws an error. Do you have any troubleshooting guidance for me? I'm running out of ideas. I've also not found where I could see this fancy dashboard for syned mails. Would really appreciate the help as I can then test Twenty fully! Cheers

Hi mine says "importing" but i see no contact updated with mails. Vps is a Digital Ocean
Guys, can you share your Twenty version, and appropriate error logs if possible ?
Hey Guillaume, thanks for reaching out.
I'm on version 0.44.14 and have sent you the erorr logs in a private chat.
Really curious to solve the error
exactly same
Yeah, I have removed the account and tried again but same occurs after a few days. I am also on the latest version 0.5 and seems to still be an issue. @Guillaume did indicate they are aware of this and working on it. Im just running without the sync until its fixed. Hopefully there is an option to resume a failed sync in coming versions
Can I ask you guys if you saw some error in the logs ? Or anything more specific that could help for the debugging ? We released last week a couple fix, but I think I am missing one
Hi, just PM'ed you a log. I have updated to V0.50.5, I will remove the email and er-add to start syncing again and keep you posted
same error, version 0.43.0 , google sync failed 2weeks ago, tried removing and adding gmail account from settings but not work.
here is worker container log. @Guillaume
Ok. thanks for sharing. An unkown error, very detailed logs, it's gonna be easy... Screw me, I should add more details when logging these type of errors lol. Love it 🙂
Is there anyway to force sync ? after first sync now it is in status of "Sync failed".
I already aplied as here https://twenty.com/developers/section/self-hosting/setup#for-gmail-and-google-calendar
Hi everyone,
I’m experiencing the same issue. Everything works well except for email and calendar syncing. I’m using v0.50.2 and have attached some logs that may be helpful. These logs were generated when I attempted to re-add the email accounts in the CRM, and I’ve hidden the email addresses in the logs.
Hi guys,
Thanks for sharing your logs, it's very helpful for us to understand where the issue may come from. On my side, I pursue the investigation this week. Also I added more logs since we are a bit blind to be honest.
What to do if you are stuck in Sync failed :
- best option is to open the database, find your table "MessageChannel", find your email in that table.
- Then you should see FAILED and FAILED_UNKNON in the columns. You can chage these values to PARTIAL_MESSAGE_LIST_FETCH_PENDING and ACTIVE
- Note : you might need to reproduce the same steps for the "calendarChannel" table in case your calendar sync failed as well
A quick update :
- we fixed this issue yesterday. I will be in the next release.
- we fixed this issue
Old fixes already implemented in the codebase :
- Microsoft concurrency error
Special ping to @hismayilov
GitHub
Fix-messaging-calendar-issues by guillim · Pull Request #11424 · ...
fixing Event Calendar bug due to TypeORM limitations
avoid systematic crash on contact creation jobs, simply logging
GitHub
datasource TTL fix by guillim · Pull Request #11444 · twentyhq/tw...
Comparing the last date a datasource was used instead of a fixed TTL : should fix workers issues "error: Error: Connection terminated"
About your subject, I see in your logs that your token is invalid "Access token is undefined or empty" so make sure you have a microsoft 365 licence. Microsoft does not let free users to use their API
Thanks. It starts to sync now. I found two rows in table "messageChannel". Both were marked as 'FAILED'. The 1st one's update time is about 1 month ago. The 2nd one is a few days ago when I tried to remove and re-add gmail account. I removed the newer row. And changed the older row as you described. Then it started to sync.
Great job.