bitwarden/server · error · BadRequestException

Not correctly configured for push relays.

Error message

Not correctly configured for push relays.

What it means

Thrown by PushController.CheckUsage at the start of every push endpoint. CheckUsage passes only when CanUse() is true: true in a Development environment, otherwise true only when the current context has an InstallationId AND the server is NOT self-hosted (push relay is a Bitwarden-cloud-only feature). If those conditions are not met, the endpoint is not usable and returns a 400.

Source

Thrown at src/Api/Platform/Push/Controllers/PushController.cs:146

    private string Prefix(string value)
    {
        if (string.IsNullOrWhiteSpace(value))
        {
            return null;
        }

        return $"{_currentContext.InstallationId!.Value}_{value}";
    }

    private void CheckUsage()
    {
        if (CanUse())
        {
            return;
        }

        throw new BadRequestException("Not correctly configured for push relays.");
    }

    private bool CanUse()
    {
        if (_environment.IsDevelopment())
        {
            return true;
        }

        return _currentContext.InstallationId.HasValue && !_globalSettings.SelfHosted;
    }
}

View on GitHub (pinned to e93b962371)

Solutions

  1. Confirm the server is the Bitwarden cloud deployment (not self-hosted) before using push relay endpoints.
  2. Ensure the caller authenticates as an installation so ICurrentContext.InstallationId is populated.
  3. In Development this check is bypassed; verify _environment is correctly classified if you expect it to pass.
  4. For self-hosted deployments, use the local push notification mechanism rather than the relay endpoints.
Defensive patterns

Strategy: validation

Validate before calling

// Only attempt push relay on cloud, authenticated as an installation
if (globalSettings.selfHosted || !currentContext.installationId) {
  throw new Error('Push relay endpoints are only available on Bitwarden cloud with an installation context');
}

Type guard

function canUsePushRelay(env: string, selfHosted: boolean, installationId?: string): boolean {
  return env === 'Development' || (!!installationId && !selfHosted);
}

Prevention

When it happens

Trigger: Calling any /push/* endpoint when the server is self-hosted (GlobalSettings.SelfHosted = true) and the environment is not Development, or when the current context has no InstallationId (the caller is not authenticated as an installation).

Common situations: Calling the push relay endpoints from a self-hosted deployment (they are cloud-only); running in a non-Development environment without a valid installation context; misconfigured GlobalSettings.SelfHosted flag; missing installation authentication middleware.

Related errors


AI-assisted analysis of bitwarden/server@e93b962371 (2026-08-13). Data as JSON: /api/errors/1d175c9e913988bd. Report an issue: GitHub.