{"record":{"id":"1d175c9e913988bd","repo":"bitwarden/server","slug":"not-correctly-configured-for-push-relays","errorCode":null,"errorMessage":"Not correctly configured for push relays.","messagePattern":"Not correctly configured for push relays\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Platform/Push/Controllers/PushController.cs","lineNumber":146,"sourceCode":"\n    private string Prefix(string value)\n    {\n        if (string.IsNullOrWhiteSpace(value))\n        {\n            return null;\n        }\n\n        return $\"{_currentContext.InstallationId!.Value}_{value}\";\n    }\n\n    private void CheckUsage()\n    {\n        if (CanUse())\n        {\n            return;\n        }\n\n        throw new BadRequestException(\"Not correctly configured for push relays.\");\n    }\n\n    private bool CanUse()\n    {\n        if (_environment.IsDevelopment())\n        {\n            return true;\n        }\n\n        return _currentContext.InstallationId.HasValue && !_globalSettings.SelfHosted;\n    }\n}\n","sourceCodeStart":128,"sourceCodeEnd":159,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Platform/Push/Controllers/PushController.cs#L128-L159","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Confirm the server is the Bitwarden cloud deployment (not self-hosted) before using push relay endpoints.","Ensure the caller authenticates as an installation so ICurrentContext.InstallationId is populated.","In Development this check is bypassed; verify _environment is correctly classified if you expect it to pass.","For self-hosted deployments, use the local push notification mechanism rather than the relay endpoints."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only attempt push relay on cloud, authenticated as an installation\nif (globalSettings.selfHosted || !currentContext.installationId) {\n  throw new Error('Push relay endpoints are only available on Bitwarden cloud with an installation context');\n}","typeGuard":"function canUsePushRelay(env: string, selfHosted: boolean, installationId?: string): boolean {\n  return env === 'Development' || (!!installationId && !selfHosted);\n}","tryCatchPattern":null,"preventionTips":["Do not call /push/* relay endpoints from a self-hosted deployment; they are cloud-only.","Ensure the caller authenticates as an installation so InstallationId is set.","Verify GlobalSettings.SelfHosted and the environment classification in configuration."],"tags":["push","relay","self-hosted","configuration","environment","bad-request"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}