Skip to content

ERRO stream error: request parse error: invalid Header provided #1709

Description

@raj-magesh

I'm trying to self-host this sync server on NixOS but I can't sync across devices.

With my configuration, I can access the syncserver using HTTP on my local machine as well as other machines on my Tailnet (my home network is mesh-linked with Tailscale): I can successfully access http://desktop:5000/__heartbeat__ on all my computers and phones.

However, even after logging in and setting "identity.sync.tokenserver.uri" = "http://desktop:5000/1.0/sync/1.5";, on all machines, Firefox doesn't show the other devices.

When I run journalctl -b 0 -u firefox-syncserver.service, I see the following error:

Jun 18 22:45:40 desktop syncserver[87771]: Jun 19 02:45:40.578 ERRO stream error: request parse error: invalid Header provided

What might I be missing? Are there any other logs I can provide? Any help would be appreciated!

Latest log file from `about:sync-log`:
1750300976802	Sync.Status	INFO	Resetting Status.
1750300976802	Sync.Status	DEBUG	Status.service: undefined => success.status_ok
1750300976802	FirefoxAccounts	TRACE	initializing new storage manager
1750300976802	FirefoxAccounts	TRACE	starting fetch of json user data
1750300976802	Sync.SyncScheduler	TRACE	Setting SyncScheduler policy values to defaults.
1750300976802	Sync.SyncScheduler	DEBUG	Clearing sync triggers and the global score.
1750300976802	Sync.Service	INFO	Loading Weave 1.141.0
1750300976803	Sync.Engine.Clients	DEBUG	Engine constructed
1750300976803	Sync.Engine.Clients	DEBUG	Resetting clients last sync time
1750300976803	Sync.Engine.Addons	DEBUG	Engine constructed
1750300976805	FirefoxAccounts	TRACE	finished fetch of json user data - took: 3
1750300976805	FirefoxAccounts	DEBUG	reading secure storage with existing: []
1750300976805	FirefoxAccounts	TRACE	starting fetch of user data from the login manager
1750300976806	FirefoxAccounts	DEBUG	secure read fetched items: ["scopedKeys"]
1750300976806	FirefoxAccounts	TRACE	initializing of new storage manager done
1750300976807	Sync.Engine.Addons	DEBUG	SyncEngine initialized: addons
1750300976807	Sync.AddonsReconciler	DEBUG	No data seen in loaded file: addonsreconciler
1750300976807	Sync.Engine.Passwords	DEBUG	Engine constructed
1750300976812	Sync.Engine.Passwords	DEBUG	SyncEngine initialized: passwords
1750300976813	Sync.Engine.Prefs	DEBUG	Engine constructed
1750300976822	Sync.Engine.Prefs	DEBUG	SyncEngine initialized: prefs
1750300976823	Sync.Engine.Bookmarks	DEBUG	Engine constructed
1750300976825	Sync.Engine.Bookmarks	DEBUG	SyncEngine initialized: bookmarks
1750300976825	Sync.Engine.Forms	DEBUG	Engine constructed
1750300976826	Sync.Engine.Forms	DEBUG	SyncEngine initialized: forms
1750300976826	Sync.Engine.History	DEBUG	Engine constructed
1750300976828	Sync.Engine.History	DEBUG	SyncEngine initialized: history
1750300976828	Sync.Engine.Tabs	DEBUG	Engine constructed
1750300976829	Sync.Engine.Tabs	DEBUG	SyncEngine initialized: tabs
1750300976830	Sync.Engine.Tabs	INFO	Got a bridged engine!
1750300976830	Sync.Engine.Addresses	DEBUG	Engine constructed
1750300976831	Sync.Engine.Addresses	DEBUG	SyncEngine initialized: addresses
1750300976832	Sync.Engine.CreditCards	DEBUG	Engine constructed
1750300976836	Sync.Engine.CreditCards	DEBUG	SyncEngine initialized: creditcards
1750300976836	Sync.Engine.Extension-Storage	DEBUG	Engine constructed
1750300976838	Sync.Engine.Extension-Storage	DEBUG	SyncEngine initialized: extension-storage
1750300976874	Sync.Engine.Extension-Storage	INFO	Got a bridged engine!
1750300976874	Sync.Service	INFO	Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0
1750300976875	Sync.AddonsReconciler	INFO	Registering as Add-on Manager listener.
1750300976875	Sync.AddonsReconciler	DEBUG	Adding change listener.
1750300976875	Sync.Engine.History.Tracker	INFO	Adding Places observer.
1750300976878	FirefoxAccounts	DEBUG	FxAccountsProfileClient: Initialized
1750300976878	FirefoxAccounts	DEBUG	FxAccountsProfileClient: Requested profile
1750300976878	FirefoxAccounts	DEBUG	getOAuthToken enter
1750300976878	FirefoxAccounts	TRACE	getCachedToken returning cached token
1750300976878	FirefoxAccounts	DEBUG	getOAuthToken returning a cached token
1750300976878	Services.Common.RESTRequest	DEBUG	GET request to https://profile.accounts.firefox.com/v1/profile
1750300976883	Sync.Service	DEBUG	User-Agent: Firefox/139.0.4 (Linux x86_64) FxSync/1.141.0.20250609112858.desktop
1750300976883	Sync.Service	INFO	Starting sync at 2025-06-18 22:42:56 in browser session aVBMHVDENXA5
1750300976883	Sync.Service	DEBUG	In sync: should login.
1750300976883	Sync.Service	INFO	User logged in successfully - verifying login.
1750300976883	Sync.SyncAuthManager	DEBUG	unlockAndVerifyAuthState already has (or can fetch) sync keys
1750300976883	Sync.Status	DEBUG	Status.login: success.login => success.status_ok
1750300976883	Sync.Status	DEBUG	Status.service: success.status_ok => error.login.failed
1750300976883	Sync.Service	DEBUG	Fetching unlocked auth state returned success.status_ok
1750300976884	Sync.SyncAuthManager	INFO	Getting sync key
1750300976884	FirefoxAccounts	DEBUG	getOAuthToken enter
1750300976884	FirefoxAccounts	TRACE	getCachedToken returning cached token
1750300976884	FirefoxAccounts	DEBUG	getOAuthToken returning a cached token
1750300976884	Sync.SyncAuthManager	INFO	Getting a sync token from: http://desktop:5000/1.0/sync/1.5
1750300976884	Sync.SyncAuthManager	DEBUG	Getting a token using OAuth
1750300976884	Services.Common.TokenServerClient	DEBUG	Beginning OAuth token exchange: http://desktop:5000/1.0/sync/1.5
1750300976884	Services.Common.RESTRequest	DEBUG	GET request to http://desktop:5000/1.0/sync/1.5
1750300976886	Services.Common.RESTRequest	DEBUG	Channel redirect: http://desktop:5000/1.0/sync/1.5, https://desktop:5000/1.0/sync/1.5, 10
1750300976886	Services.Common.RESTRequest	DEBUG	Channel redirect: http://desktop:5000/1.0/sync/1.5, https://desktop:5000/1.0/sync/1.5, internal = false
1750300976888	Services.Common.RESTRequest	DEBUG	GET https://desktop:5000/1.0/sync/1.5 failed: 2153394151 - 
1750300976888	Sync.SyncAuthManager	ERROR	Non-authentication error in _fetchTokenForUser: TokenServerClientNetworkError({"error":{}})(resource://services-common/tokenserverclient.sys.mjs:28:36) JS Stack trace: TokenServerClientNetworkError@tokenserverclient.sys.mjs:51:16
_tokenServerExchangeRequest@tokenserverclient.sys.mjs:235:13
1750300976888	Sync.Status	DEBUG	Status.login: success.status_ok => error.login.reason.network
1750300976888	Sync.Status	DEBUG	Status.service: error.login.failed => error.login.failed
1750300976888	Sync.SyncAuthManager	INFO	Failed to fetch the cluster URL: TokenServerClientNetworkError({"error":{}})(resource://services-common/tokenserverclient.sys.mjs:28:36) JS Stack trace: TokenServerClientNetworkError@tokenserverclient.sys.mjs:51:16
_tokenServerExchangeRequest@tokenserverclient.sys.mjs:235:13
1750300976891	Sync.Service	DEBUG	verifyLogin failed: TokenServerClientNetworkError({"error":{}})(resource://services-common/tokenserverclient.sys.mjs:28:36) JS Stack trace: TokenServerClientNetworkError@tokenserverclient.sys.mjs:51:16
_tokenServerExchangeRequest@tokenserverclient.sys.mjs:235:13
1750300976891	Sync.Status	DEBUG	Status.login: error.login.reason.network => error.login.reason.network
1750300976891	Sync.Status	DEBUG	Status.service: error.login.failed => error.login.failed
1750300976891	Sync.ErrorHandler	ERROR	Sync encountered a login error
1750300976891	Sync.SyncScheduler	DEBUG	Clearing sync triggers and the global score.
1750300976891	Sync.SyncScheduler	DEBUG	Next sync in 3600000 ms. (why=schedule)
1750300976891	Sync.Service	DEBUG	Exception calling WrappedLock: Error: Login failed: error.login.reason.network(resource://services-sync/service.sys.mjs:1051:15) JS Stack trace: onNotify@service.sys.mjs:1051:15
1750300976891	Sync.Service	DEBUG	Not syncing: login returned false.
1750300976894	FirefoxAccounts	DEBUG	FxAccountsWebChannel registered: account_updates with origin https://accounts.firefox.com
1750300976908	FirefoxAccounts	INFO	fetching updated device list
1750300976909	Services.Common.RESTRequest	DEBUG	GET request to https://api.accounts.firefox.com/v1/account/attached_clients
1750300976910	Services.Common.RESTRequest	DEBUG	GET request to https://api.accounts.firefox.com/v1/account/devices?filterIdleDevicesTimestamp=1748486576909

Here is my NixOS configuration:

{ pkgs, config, ... }:
{
  # documentation for this configuration
  # https://nixos.org/manual/nixos/stable/#module-services-firefox-syncserver

  services.mysql.package = pkgs.mariadb;

  services.firefox-syncserver = {
    enable = true;
    secrets = config.sops.templates."firefox-syncserver/secrets".path;
    singleNode = {
      enable = true;
      hostname = "0.0.0.0";
      capacity = 1;
      enableNginx = true;
    };
    settings = {
      host = "0.0.0.0";
    };
  };

  networking.firewall.allowedTCPPorts = [ config.services.firefox-syncserver.settings.port ];

  sops.secrets = {
    "firefox-syncserver/SYNC_MASTER_SECRET" = { };
    "firefox-syncserver/SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET" = { };
  };
  sops.templates."firefox-syncserver/secrets" = {
    content = ''
      SYNC_MASTER_SECRET=${config.sops.placeholder."firefox-syncserver/SYNC_MASTER_SECRET"}
      SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET=${
        config.sops.placeholder."firefox-syncserver/SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET"
      }
    '';
  };

  environment.persistence."/persist" = {
    hideMounts = true;
    directories = [
      "/var/lib/mysql"
    ];
  };
}

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions