Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to sync N1 to a local sync-engine #2658

Closed
jathpala opened this issue Jul 22, 2016 · 7 comments
Closed

Unable to sync N1 to a local sync-engine #2658

jathpala opened this issue Jul 22, 2016 · 7 comments

Comments

@jathpala
Copy link
Contributor

I have recently noticed a problem using N1 connected to a locally run sync-engine. I have set up my sync-engine using the recommended vagrant setup process and authorised a gmail account. Querying localhost:5555/accounts I get the expected:

[
{
"account_id": "{account_id}",
"email_address": "[email protected]",
"id": "{account_id}",
"name": "My Name",
"object": "account",
"organization_unit": "label",
"provider": "gmail",
"sync_state": "running"
}
]

When I run "N1.sh --dev" I click the new "Hosting your own sync engine?" option. I then put in localhost and 5555 as my server and port. When N1 loads it says it's syncing my mailbox but nothing happens despite waiting over 10 minutes.

On the console I see "APIError: Identity is present but identity token is missing." messages in a few places. I noticed there is no *.nylas.accountTokens in my config.json file any longer either. When I manually enter that option as per previous setup instruction I don't get the APIError message anymore but the mailbox still doesn't sync. It just waits forever.

I think this is an N1 error rather than sync-engine because I can visit localhost:5555/threads from my browser and see all the appropriate emails.

I suspect this has something to do with commit #98e351ebeb4857a77d256034fb96b5665dc45b48 but I'm not sure.

Are there any related issues?

No

What operating system are you using?

Arch Linux

What version of N1 are you using?

Latest version of the code from git master

Bug?

Do you have any third-party plugins installed?

No

Is the issue related to a specific email provider (Gmail, Exchange, etc.)?

No

Is the issue reproducible with a particular attachment, message, signature, etc?

N/A

@jathpala
Copy link
Contributor Author

I've been playing about with this a little. I've found a few steps you can do to bypass this bug for now and maybe it'll give some clues as to what the problem is.

Firstly to start with I removed ~/.nylas/ to give myself a clean slate. When I run N1 I get the Welcome page that just says "Welcome to Nylas." After selecting run a local sync-engine and setting it to localhost:5555 I get the bug described above where mailbox won't sync.

I then edit config.json to add an appropriate *.nylas.accountTokens entry and remove the *.nylas.identity. When I restart Nylas, the welcome page says "Welcome back to Nylas. Some things have changed since etc. etc." Again I select to run a local sync-engine with localhost:5555 and this time I can see my current emails though new emails don't get synced as they come in.

Interestingly when I look at config.json after this, *.nylas.identity is the same as what it was previously and *.nylas.accountTokens is gone.

If I now replace *.nylas.accountTokens again (and leave *.nylas.identity as it is), and then restart N1 everything works correctly. I can see my emails and new mail arrives as expected. config.json now includes *.nylas.accountTokens and from now on, every time I open N1 everything seems to work as expected.

Hope this helps track down the source of the problem.

@jackiehluo
Copy link
Contributor

jackiehluo commented Jul 22, 2016

Interesting... you shouldn't need the accountTokens anymore because it should be stored in your system keychain instead. You should, however, need a Nylas identity. I'll take a look—are you using both the latest versions of N1 and the sync engine?

@jathpala
Copy link
Contributor Author

Yes, just double checked now. Latest version of both N1 and sync-engine from git. Still same problem with same workaround as described above. I noticed that there are two different welcome screens (initial welcome and the welcome back). Is there some logic in the welcome back situation that is not being done on the initial welcome?

@jackiehluo
Copy link
Contributor

Nope, that shouldn't make a difference! But APIError: Identity is present but identity token is missing. indicates that the token wasn't correctly added to your system keychain the first time, which makes it odd that it would work a second time. Same with accountTokens—I think we check the config.json for them as a fallback if they can't be found in the keychain. Do you have Gnome Keyring installed correctly and everything?

@jathpala
Copy link
Contributor Author

I'm using KDE so I don't have gnome keyring installed. Does this work with kwallet also or is it gnome-keyring only?

@jackiehluo
Copy link
Contributor

It's Gnome Keyring only! That'll be the issue, unfortunately, since it's a dependency for N1—going to close this issue for now.

@alexanderadam
Copy link

alexanderadam commented Feb 23, 2017

I'm having the same issue sometimes.
This time everything began because one of my GMail acccounts was switched to 2-factor auth and this broke the Nylas sync for this particular account.

I read that some people had success by removing and readding the account again so I wanted to give it a try as well.

It looked good in the beginning (the syncing note appeared for the readded account) but at some point the token is is missing message came up:

nylas_error_1

I closed the modal message and the Create a Nylas ID screen came up:

nylas_error_2

What is important here as well: this screen makes absolutely no sense for anybody who uses a self hosted sync engine. (Should I create another issue for that?)

Please note as well: It's not the first time that the Identity is present but identity token is missing issue appeared for me.

I'm running Ubuntu 16.10 (but this issue appeared for my for any Ubuntu version before as well) and I'm running it against a self hosted sync engine.

A working config (~/config.json) contained


     "nylas": {
      "identity": {
        "firstname": "",
        "lastname": "",
        "valid_until": null,
        "email": "",
        "id": 1,
        "seen_welcome_page": true
      },

which should avoid the Create a Nylas ID screen. But the Identity is present but identity token is missing issue will remove this entry again.

So, for now, if this issue happens I don't know any solution except from removing everything in ~/.nylas/ and readding, syncing and waiting again. 😿

If I remove the readded account and add the identity key in the config everything runs fine again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants