gitroomhq/postiz-app · warning · Error

Invalid integration

Error message

Invalid integration

What it means

After resolving the integration, the controller fetches its provider implementation and requires it to expose changeProfilePicture or changeNickname. If the provider implements neither capability, Error('Invalid integration') is thrown — the channel type simply does not support identity changes.

Source

Thrown at apps/backend/src/api/routes/integrations.controller.ts:152

  ) {
    if (typeof body !== 'string') {
      throw new Error('Invalid body');
    }

    await this._integrationService.updateProviderSettings(org.id, id, body);
  }
  @Post('/:id/nickname')
  async setNickname(
    @GetOrgFromRequest() org: Organization,
    @Param('id') id: string,
    @Body() body: { name: string; picture: string }
  ) {
    const integration = await this._integrationService.getIntegrationById(
      org.id,
      id
    );
    if (!integration) {
      throw new Error('Invalid integration');
    }

    const manager = this._integrationManager.getSocialIntegration(
      integration.providerIdentifier
    );
    if (!manager.changeProfilePicture && !manager.changeNickname) {
      throw new Error('Invalid integration');
    }

    const { url } = manager.changeProfilePicture
      ? await manager.changeProfilePicture(
          integration.internalId,
          integration.token,
          body.picture
        )
      : { url: '' };

    const { name } = manager.changeNickname

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Check provider capabilities before showing the action in the UI (feature-detect changeProfilePicture/changeNickname)
  2. Skip the operation for providers that do not implement it
  3. If you own the provider, implement changeNickname (and optionally changeProfilePicture)

Example fix

// before
if (!manager.changeProfilePicture && !manager.changeNickname) {
  throw new Error('Invalid integration');
}
// after
const canChange = Boolean(manager.changeProfilePicture || manager.changeNickname);
if (!canChange) {
  throw new HttpException('Provider does not support identity changes', HttpStatus.BAD_REQUEST);
}
Defensive patterns

Strategy: type-guard

Validate before calling

const caps = getProviderCapabilities(integration.providerIdentifier);
if (!caps.changeNickname && !caps.changeProfilePicture) hideIdentityActions();

Type guard

const supportsIdentityChange = (p: Provider) => Boolean(p.changeNickname || p.changeProfilePicture);

Try / catch

try { await updateBotPicture(id); } catch (e) { if (e.message === 'Invalid integration') showUnsupportedNotice(); else throw e; }

Prevention

When it happens

Trigger: Calling the nickname/bot-picture endpoint on a channel whose provider class has no changeProfilePicture and no changeNickname methods (e.g. read-only or constrained providers).

Common situations: Generic UI showing the 'change bot identity' action for every connected channel even when the provider lacks support; new custom provider implemented without the optional methods.

Related errors


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