gitroomhq/postiz-app · error · HttpException

Integration not found

Error message

Integration not found

What it means

The public API endpoint getIntegrationSettings could not find an integration with the given id belonging to the authenticated organization. The backend calls _integrationService.getIntegrationById(org.id, id), which scopes the lookup to the organization of the API key, and any miss results in an HTTP 404 with msg 'Integration not found'. It does not distinguish 'wrong org' from 'nonexistent id', so both look identical to the caller.

Source

Thrown at apps/backend/src/public-api/routes/v1/public.integrations.controller.ts:456

      }
    }

    return this._integrationService.deleteChannel(org.id, id);
  }

  @Get('/integration-settings/:id')
  async getIntegrationSettings(
    @GetOrgFromRequest() org: Organization,
    @Param('id') id: string
  ) {
    Sentry.metrics.count('public_api-request', 1);
    const loadIntegration = await this._integrationService.getIntegrationById(
      org.id,
      id
    );

    if (!loadIntegration) {
      throw new HttpException({ msg: 'Integration not found' }, 404);
    }

    const verified =
      JSON.parse(loadIntegration.additionalSettings || '[]')?.find(
        (p: any) => p?.title === 'Verified'
      )?.value || false;

    const integration = socialIntegrationList.find(
      (p) => p.identifier === loadIntegration.providerIdentifier
    )!;

    if (!integration) {
      return {
        output: { rules: '', maxLength: 0, settings: {}, tools: [] as any[] },
      };
    }

    const maxLength = integration.maxLength(verified);

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Verify the id by listing the org's integrations via the public integrations endpoint and confirm the id appears there before requesting settings
  2. Confirm the API key / organization context matches the workspace that owns the integration
  3. If the channel was reconnected recently, re-fetch integrations — the old id is likely stale because a reconnect creates a new integration record
  4. Check that the integration was not deleted or disconnected by a team member in the Postiz UI

Example fix

// before
const settings = await publicApi.getIntegrationSettings('12345'); // 404

// after
const list = await publicApi.listIntegrations();
const target = list.find((i) => i.id === '12345');
if (!target) throw new Error(`Integration 12345 not visible to this API key`);
const settings = await publicApi.getIntegrationSettings(target.id);
Defensive patterns

Strategy: validation

Validate before calling

const integrations = await publicApi.listIntegrations();
const exists = integrations.some((i) => i.id === requestedId);
if (!exists) throw new Error(`Integration ${requestedId} not found in this org`);

Type guard

const isIntegration = (i: unknown, id: string): i is { id: string } =>
  !!i && typeof i === 'object' && (i as any).id === id;

Try / catch

try {
  await getIntegrationSettings(id);
} catch (e: any) {
  if (e?.status === 404) { /* refresh integration list; id is stale or wrong org */ }
  else throw e;
}

Prevention

When it happens

Trigger: GET on the public v1 integrations settings route with an id that (a) does not exist, (b) was deleted, or (c) belongs to a different organization than the one the API key maps to. Passing an internal integration id from another workspace, or reusing an id captured before the channel was disconnected/removed, produces this 404.

Common situations: Hardcoding an integration id in scripts after the channel was reconnected (which creates a new integration row); copying ids between environments (staging vs production); using an org-scoped API key and assuming it can read any integration id; typos or truncated ids from the public integrations list endpoint.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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