Add Google Account does not finish

Description

I regularly get a message that “Some accounts could not be synced, retrying…” – I am unable to get a more detailed description, for example which accounts have syncing issues.

But considering that my G Suite account was not receiving new incoming emails, I suspected that this was the one with the issues.

In my attempts to get my work email working again, I removed the account and tried to set it up again.

And now I can’t set it up again.

To Reproduce…

Steps to reproduce the behavior:

  1. Mailspring → Add Account
  2. Click on “Gmail or G Suite”
  3. New browser window opens asking me to log in to my account. I do that.
  4. I get asked whether to authorize Mailspring for my email, I accept.
  5. Get a new screen: “You’re all set, go back to Mailspring to finish setup.”
  6. Mailspring still has the “Connecting to Google…” page open. After a few minutes, it changes to “Sorry, we had trouble logging you in. Failed to fetch.” And a button “Try again” which brings me back to the selection for the email provider.

I’ve tried my default browser (Vivaldi), but also Safari and Chrome, it didn’t help.

Expected Behavior

I expect that after step 5 above, Mailspring has connected to the account and syncronised the emails. Or at least gives me new options for how to proceed.

Screenshots


Setup

  • OS and Version: MacOS Monterey 12.3.1
  • Installation Method: It’s been a while, but I’ve used the default installer.
  • Mailspring Version: 1.10.3

Additional Context

I really wish there was an option to get more detailed error messages.

Same issue here. I’ve tried both a Google Workspace and personal Gmail account.

I have a few updates. At some point, the connection worked, but now the mail isn’t syncing again.

That said, I have found the log files in $HOME/Library/Application\ Support/Mailspring, and here is the hopefully relevant part of the log file:

6176 [2022-06-03 09:58:58.908] [background] [info] Fetching XOAuth2 access token (gmail) for 9476a2a6
6176 [2022-06-03 09:59:29.335] [background] [critical]
***
*** Mailspring Sync
*** An exception occurred during program execution:
*** {"debuginfo":"https://www.googleapis.com/oauth2/v4/token","key":"Timeout was reached","retryable":true,"what":"std::exception"}
***

6176 [2022-06-03 09:59:29.336] [background] [critical] *** Stack trace (line numbers are approximate):
*** in mailsync     ValidateRequestResp(CURLcode, void*, string)
*** in mailsync     PerformRequest(void*)
*** in mailsync     PerformJSONRequest(void*)
*** in mailsync     MakeOAuthRefreshRequest(string, string, string)
*** in mailsync     XOAuth2TokenManager::partsForAccount(shared_ptr)
*** in mailsync     MailUtils::configureSessionForAccount(mailcore::IMAPSession&, shared_ptr)
*** in mailsync     SyncWorker::configure()
*** in mailsync     runBackgroundSyncWorker()
*** in mailsync     main::$_6::operator()() const
*** in mailsync     void* __thread_proxy(void*)
*** 0x7ff81abd9f6b  thread_start()
***

6176 [2022-06-03 09:59:29.336] [background] [info] --sleeping
6176 [2022-06-03 10:01:29.341] [background] [info] Fetching XOAuth2 access token (gmail) for 9476a2a6
6176 [2022-06-03 10:01:29.955] [metadata] [info] Metadata delta stream starting...
6176 [2022-06-03 10:01:30.894] [metadata] [error] Received invalid JSON in server delta stream: <html>
6176 [2022-06-03 10:01:30.894] [metadata] [error] Received invalid JSON in server delta stream: <head><title>500 Internal Server Error</title></head>
6176 [2022-06-03 10:01:30.894] [metadata] [error] Received invalid JSON in server delta stream: <body>
6176 [2022-06-03 10:01:30.894] [metadata] [error] Received invalid JSON in server delta stream: <center><h1>500 Internal Server Error</h1></center>
6176 [2022-06-03 10:01:30.894] [metadata] [error] Received invalid JSON in server delta stream: <hr><center>nginx/1.20.0</center>
6176 [2022-06-03 10:01:30.894] [metadata] [error] Received invalid JSON in server delta stream: </body>
6176 [2022-06-03 10:01:30.894] [metadata] [error] Received invalid JSON in server delta stream: </html>
6176 [2022-06-03 10:01:30.894] [metadata] [info] Metadata delta stream closed.
6176 [2022-06-03 10:01:31.337] [metadata] [info] Will retry in 300 sec.
6176 [2022-06-03 10:01:59.812] [background] [critical]
***
*** Mailspring Sync
*** An exception occurred during program execution:
*** {"debuginfo":"https://www.googleapis.com/oauth2/v4/token","key":"Timeout was reached","retryable":true,"what":"std::exception"}
***

6176 [2022-06-03 10:01:59.813] [background] [critical] *** Stack trace (line numbers are approximate):
*** in mailsync     ValidateRequestResp(CURLcode, void*, string)
*** in mailsync     PerformRequest(void*)
*** in mailsync     PerformJSONRequest(void*)
*** in mailsync     MakeOAuthRefreshRequest(string, string, string)
*** in mailsync     XOAuth2TokenManager::partsForAccount(shared_ptr)
*** in mailsync     MailUtils::configureSessionForAccount(mailcore::IMAPSession&, shared_ptr)
*** in mailsync     SyncWorker::configure()
*** in mailsync     runBackgroundSyncWorker()
*** in mailsync     main::$_6::operator()() const
*** in mailsync     void* __thread_proxy(void*)
*** 0x7ff81abd9f6b  thread_start()
***

6176 [2022-06-03 10:01:59.813] [background] [info] --sleeping