{"record":{"id":"7d2fc74b347f79a8","repo":"gitroomhq/postiz-app","slug":"invalid-provider","errorCode":null,"errorMessage":"Invalid provider","messagePattern":"Invalid provider","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/backend/src/api/routes/integrations.controller.ts","lineNumber":349,"sourceCode":"\n  @Post('/function')\n  async functionIntegration(\n    @GetOrgFromRequest() org: Organization,\n    @Body() body: IntegrationFunctionDto\n  ): Promise<any> {\n    const getIntegration = await this._integrationService.getIntegrationById(\n      org.id,\n      body.id\n    );\n    if (!getIntegration) {\n      throw new Error('Invalid integration');\n    }\n\n    const integrationProvider = this._integrationManager.getSocialIntegration(\n      getIntegration.providerIdentifier\n    );\n    if (!integrationProvider) {\n      throw new Error('Invalid provider');\n    }\n\n    // @ts-ignore\n    if (integrationProvider[body.name]) {\n      try {\n        // @ts-ignore\n        const load = await integrationProvider[body.name](\n          getIntegration.token,\n          body.data,\n          getIntegration.internalId,\n          getIntegration\n        );\n\n        return load;\n      } catch (err) {\n        // The platform will keep rejecting this channel until the user\n        // re-connects it: mark it as needing a refresh instead of retrying.\n        if (err instanceof Disconnect) {","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/apps/backend/src/api/routes/integrations.controller.ts#L331-L367","documentation":"The final guard in functionIntegration: the provider implementation exists but the dynamic method requested via body.name is not present on it (integrationProvider[body.name] is falsy), so Error('Invalid provider') is thrown. The dispatcher refuses to call methods the provider does not implement.","triggerScenarios":"Calling the generic integration-function endpoint with name='getMentions' (or any method) for a provider whose class does not define that method, or with a misspelled method name.","commonSituations":"Frontend assuming all providers implement an optional capability like mentions or analytics; method renamed across versions while old clients still call the previous name; probing the endpoint manually.","solutions":["Verify the method name string matches the provider's implementation exactly (case-sensitive)","Feature-detect before calling: only invoke methods the provider is known to expose","If building a custom provider, implement the method or have the client skip it"],"exampleFix":"// before\nawait api.functionIntegration({ id, name: 'getMentions' });\n// after\nconst supported = await api.getProviderCapabilities(id); // includes 'getMentions'?\nif (supported.includes('getMentions')) {\n  await api.functionIntegration({ id, name: 'getMentions' });\n}","handlingStrategy":"type-guard","validationCode":"const capabilities = await getProviderCapabilities(integration.id);\nif (!capabilities.includes(methodName)) { skipFeature(methodName); }","typeGuard":"const supportsMethod = (p: Provider, m: string) => typeof (p as any)[m] === 'function';","tryCatchPattern":"try { await functionIntegration({ id, name }); } catch (e) { if (e.message === 'Invalid provider') hideFeature(name); else throw e; }","preventionTips":["Never assume optional provider methods exist — feature-detect per channel","Keep method-name constants shared between client and server to avoid typos"],"tags":["integrations","dynamic-dispatch","provider-capability","method-missing"],"backgroundTag":"provider-not-allowed","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}