gitroomhq/postiz-app · error · Error

Organization not found

Error message

Organization not found

What it means

During the enterprise OAuth redirect, after the org is resolved, the provider in the payload is checked against integrationManager.getAllowedSocialsIntegrations(). If the provider identifier is not in the allowed list, Error('Integration not allowed') is thrown (surfaces as 500).

Source

Thrown at apps/backend/src/api/routes/enterprise.controller.ts:63

  @Post('/url')
  async redirectParams(@Body('params') params: string) {
    try {
      const load = AuthService.verifyJWT(params) as {
        redirectUrl: string;
        apiKey: string;
        refreshId?: string;
        provider: string;
        webhookUrl: string;
      };

      if (!load || !load.redirectUrl || !load.apiKey || !load.provider) {
        return;
      }

      const org = await this._organizationService.getOrgByApiKey(load.apiKey);

      if (!org) {
        throw new Error('Organization not found');
      }

      if (
        !this._integrationManager
          .getAllowedSocialsIntegrations()
          .includes(load.provider)
      ) {
        throw new Error('Integration not allowed');
      }

      const integrationProvider = this._integrationManager.getSocialIntegration(
        load.provider
      );

      const { codeVerifier, state, url } =
        await integrationProvider.generateAuthUrl();

      if (load.refreshId) {

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Check the deployment's integration allowlist configuration and enable the provider
  2. Confirm the provider identifier in the redirect payload matches the current provider name exactly
  3. Regenerate the enterprise redirect token after provider config changes
  4. Return 400/403 from the route instead of a bare Error

Example fix

// before
throw new Error('Integration not allowed');
// after
throw new HttpException('Integration not allowed', HttpStatus.BAD_REQUEST);
Defensive patterns

Strategy: validation

Validate before calling

const allowed = await getAllowedProviders();
if (!allowed.includes(payload.provider)) throw new Error(`Provider ${payload.provider} not enabled`);

Type guard

const isAllowedProvider = (p: string, allowed: string[]) => allowed.includes(p);

Try / catch

try { await enterpriseRedirect(token); } catch (e) { if (e.message === 'Integration not allowed') surfaceProviderConfigIssue(); else throw e; }

Prevention

When it happens

Trigger: Redirect token contains a provider that is disabled in this deployment's integration configuration (e.g. a provider removed via env flags or not licensed), or a misspelled/renamed provider identifier.

Common situations: Self-hosted deployment that disabled certain integrations via PROVIDERS/env config; provider renamed across Postiz versions leaving stale tokens; enterprise token generated against a different allowlist.

Related errors


AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27). Data as JSON: /api/errors/ba758c742aaf11f7. Report an issue: GitHub.