Running my own sync server does not work

RESOLVED INVALID

Status

Cloud Services
Firefox Sync: Backend
RESOLVED INVALID
a year ago
a year ago

People

(Reporter: botond, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

a year ago
I tried running my own Sync server, and found that it didn't work.

Here's what I did:

  - Followed the instructions here [1] to run a local Sync 1.5
    server. I didn't change anything in the config file (leaving
    the URL as the default, http://localhost:5000/), and just
    ran "make build" and then "make serve".

  - Visited http://localhost:5000/ in my browser to make sure
    the service is running. I got a page with the words "it works!".

  - Opened two instances of Firefox with two different profiles.
    In both, I changed the pref "identity.sync.tokenserver.uri"
    to "http://localhost:5000/1.0/sync/1.5".

  - Created a Firefox account and signed into it in both instances.
    Enabled Sync and configured it to sync "Tabs".

  - Opened some tabs in one instance, to see if they would be synced
    to the other. Pressed the Sync button in the hamburger menu.

  - In the other instance, pressed the Sync button in the hamburger
    menu. Clicked on "Synced Tabs" to see if any tabs were synced,
    but none were.

I'm running Firefox 48.0 on Debian Stable.

Both instances produce the following output when I press the Sync button:

1473551495206   Sync.BrowserIDManager   ERROR   Non-authentication error in _fetchTokenForUser: TokenServerClientError({"message":{}}) (resource://gre/modules/services-common/tokenserverclient.js:38:36) JS Stack trace: TokenServerClientError@tokenserverclient.js:36:16 < onResponse@tokenserverclient.js:298:21 < onStopRequest@rest.js:499:5 < waitForSyncCallback@async.js:98:7 < makeSpinningCallback/callback.wait@async.js:152:27 < onNotify@service.js:966:7 < WrappedNotify@util.js:146:21 < WrappedLock@util.js:101:16 < WrappedCatch@util.js:75:16 < login@service.js:988:12 < sync/<@service.js:1236:14 < WrappedCatch@util.js:75:16 < sync@service.js:1232:5
1473551495207   Sync.BrowserIDManager   ERROR   Background fetch for key bundle failed: TokenServerClientError({"message":{}}) (resource://gre/modules/services-common/tokenserverclient.js:38:36) JS Stack trace: TokenServerClientError@tokenserverclient.js:36:16 < onResponse@tokenserverclient.js:298:21 < onStopRequest@rest.js:499:5 < waitForSyncCallback@async.js:98:7 < makeSpinningCallback/callback.wait@async.js:152:27 < onNotify@service.js:966:7 < WrappedNotify@util.js:146:21 < WrappedLock@util.js:101:16 < WrappedCatch@util.js:75:16 < login@service.js:988:12 < sync/<@service.js:1236:14 < WrappedCatch@util.js:75:16 < sync@service.js:1232:5
1473551495208   Sync.BrowserIDManager   ERROR   Could not authenticate: TokenServerClientError({"message":{}}) (resource://gre/modules/services-common/tokenserverclient.js:38:36) JS Stack trace: TokenServerClientError@tokenserverclient.js:36:16 < onResponse@tokenserverclient.js:298:21 < onStopRequest@rest.js:499:5 < waitForSyncCallback@async.js:98:7 < makeSpinningCallback/callback.wait@async.js:152:27 < onNotify@service.js:966:7 < WrappedNotify@util.js:146:21 < WrappedLock@util.js:101:16 < WrappedCatch@util.js:75:16 < login@service.js:988:12 < sync/<@service.js:1236:14 < WrappedCatch@util.js:75:16 < sync@service.js:1232:5
1473551495213   Sync.ErrorHandler       ERROR   Sync encountered a login error

It works fine when I use the default sync server (the one run by Mozilla) rather than trying to run my own.

What am I doing wrong?

[1] http://docs.services.mozilla.com/howtos/run-sync-1.5.html
I suspect the token server URI is wrong - the log snippet isn't clear, but http://localhost:5000/1.0/sync/1.5 may be a 404. According to those docs, http://localhost:5000/token/1.0/sync/1.5 looks like the value you want.
(Reporter)

Comment 2

a year ago
You're right, this was the problem.

As the instructions said that the value of "identity.sync.tokenserver.uri" should be "the URL of your server with a path of token/1.0/sync/1.5", I assumed that the default URL has this form, too.

However, the default URL is in fact https://token.services.mozilla.com/1.0/sync/1.5, without the "token" part. I didn't notice this, and just replaced the domain name with http://localhost:5000, resulting in the incorrect URL http://localhost:5000/1.0/sync/1.5.

So, my mistake, but perhaps an understandable one. 

Sync is working fine with the local server now. Thanks!
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.