nylas-mail icon indicating copy to clipboard operation
nylas-mail copied to clipboard

Running Against Open Source Sync Engine

Open seniorihor opened this issue 10 years ago • 10 comments

Hi fellas! :wave:

I got trouble with configuration of Self-Hosted Nylas Sync Engine, following this instruction: https://github.com/nylas/N1/blob/master/CONFIGURATION.md

  1. Nylas Sync Engine in Vagrant installed successfully.
  2. Added acount with inbox-auth script.
  3. Started Engine and the API.
  4. Made changes to ~/.nylas/config.json just like written in guide.

When Nylas N1 started and attempt to synchronize with server I get the following error: APIError: Could not verify access credentials.

I made sure server setup and works correctly: curl --user 'MY_ID' http://localhost:5555/threads return JSON of my emails, so credentials are correct.

System: Ubuntu 16.04 N1: 0.4.32-1de17e7

Please, let me know if needed some more information. Looking forward for your suggestions.

seniorihor avatar May 04 '16 05:05 seniorihor

Open from the menu: Developer > Activity Manager

What requests do you see?

kevinmartin avatar May 04 '16 16:05 kevinmartin

Here's a part of output with cut hash in address:

12:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/contacts/rankings"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/events?limit=30&offset=0"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/events?view=count"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/calendars?limit=30&offset=0"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/calendars?view=count"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/contacts?limit=30&offset=0"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/contacts?view=count"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/drafts?limit=30&offset=0"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/drafts?view=count"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/labels?limit=1000&offset=0"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/labels?view=count"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/messages?limit=30&offset=0"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/messages?view=count"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/threads?limit=30&offset=0&view=expanded"
40112:31:19  RunCopycurl -X GET "http://SOME_HASH:@localhost:5555/threads?view=count"
40112:31:19  RunCopycurl -X POST -d '{}' "http://SOME_HASH:@localhost:5555/delta/latest_cursor"

When I execute some of these requests from terminal I get: Could not verify access credential.%

I just have no clue where I supposed to provide my credentials.

seniorihor avatar May 05 '16 10:05 seniorihor

Hmm - I have a hunch this is related to a switch we made to store access credentials in the system keychain, but I'll try to reproduce and see if I run into anything.

bengotow avatar May 05 '16 16:05 bengotow

@bengotow Have you had any success so far?

seniorihor avatar May 11 '16 12:05 seniorihor

@seniorihor Did you manage to get this working? I'm facing exactly the same problem.

shchukax avatar May 27 '16 13:05 shchukax

@shchukax I stuck on this issue and still can't manage to get it working.

seniorihor avatar May 27 '16 13:05 seniorihor

Guys, anyone got a chance to reproduce this issue or maybe some ideas how to fix it?

seniorihor avatar Jun 06 '16 16:06 seniorihor

I finally managed to get this working with a sync engine running in a local VM. I am running the VM using libvirt, so had to update the Vagrantfile for that - but that's irrelevant. It was more of a try-and-see tactic, so I'm not quite sure what finally worked, but I now have N1 running on my local linux machine talking to a sync engine running in a VM on the same linux machine - with 2 accounts - one google and one yahoo. For reference, here's my full config.json file (with ids masked, of course):

{
  "*": {
    "env": "local",
    "core": {
      "disabledPackages": [
        "composer-templates",
        "composer-translate",
        "message-view-on-github",
        "personal-level-indicators",
        "phishing-detection",
        "github-contact-card",
        "send-later",
        "link-tracking",
        "open-tracking",
        "composer-mail-merge",
        "composer-emoji",
        "activity-list",
        "composer-scheduler"
      ],
      "disabledPackagesInitialized": true,
      "workspace": {
        "mode": "split"
      },
      "keymapTemplate": "Apple Mail",
      "reading": {
        "autoloadImages": false,
        "backspaceDelete": true
      }
    },
    "updateIdentity": "my-identify-uuid",
    "devMode": true,
    "nylas": {
      "accounts": [
        {
          "client_id": "local-someId1",
          "server_id": "accountIdFromServer1",
          "object": "account",
          "account_id": "accountIdFromServer1",
          "metadata": [],
          "name": "Full Name",
          "provider": "gmail",
          "email_address": "[email protected]",
          "organization_unit": "label",
          "label": "[email protected]",
          "aliases": [],
          "sync_state": "running",
          "id": "accountIdFromServer1"
        },
        {
          "client_id": "local-someId2",
          "server_id": "accountIdFromServer2",
          "object": "account",
          "account_id": "accountIdFromServer2",
          "metadata": [],
          "name": "",
          "provider": "yahoo",
          "email_address": "[email protected]",
          "organization_unit": "folder",
          "label": "[email protected]",
          "aliases": [],
          "sync_state": "running",
          "id": "accountIdFromServer2"
        }
      ],
      "accountsVersion": 3,
      "threadCountsValid": true,
      "account-accountIdFromServer1": {
        "signature": ""
      },
      "account-accountIdFromServer2": {
        "signature": ""
      }
    }
  }
}

I don't remember ever putting in the values for client_id, so it must be something that N1 did on its own. Hopefully, this helps someone.

Now if only the open source version supported exchange...

shchukax avatar Jun 07 '16 09:06 shchukax

@shchukax, would you mind sharing your vagrantfile that is converted to work with libvirt?

ConorIA avatar Jul 06 '16 20:07 ConorIA

I think this issue should be fixed with the change we made a while back that added a UI to self-hosting! Closing for now.

jackiehluo avatar Aug 22 '16 19:08 jackiehluo