gitroomhq/postiz-app · error · Error
Function not found
Error message
Function not found
What it means
Thrown by the integrations controller when the loop over an organization's integrations finishes without finding one whose id matches the requested channel id. It signals that the caller referenced a function/integration id that does not exist for this org.
Source
Thrown at apps/backend/src/api/routes/integrations.controller.ts:399
return;
}
const { accessToken } = data;
if (accessToken) {
if (integrationProvider.refreshWait) {
await timer(10000);
}
return this.functionIntegration(org, body);
}
return false;
}
return false;
}
}
throw new Error('Function not found');
}
@Post('/disable')
disableChannel(
@GetOrgFromRequest() org: Organization,
@Body('id') id: string
) {
return this._integrationService.disableChannel(org.id, id);
}
@Post('/enable')
enableChannel(
@GetOrgFromRequest() org: Organization,
@Body('id') id: string
) {
return this._integrationService.enableChannel(
org.id,
// @ts-ignoreView on GitHub (pinned to 0f1647f749)
Solutions
- Verify the id exists in the org's integration list (GET integrations) before calling
- Refresh client-side cached channel data and retry with the current id
- Check the request payload is not being truncated or overwritten by form encoding
Example fix
// before
await api.post('/integrations/disable', { id: staleId });
// after
const channels = await api.get('/integrations');
const channel = channels.find(c => c.id === staleId);
if (!channel) throw new Error('Channel no longer exists — refresh list');
await api.post('/integrations/disable', { id: channel.id }); Defensive patterns
Strategy: validation
Validate before calling
const exists = (await api.get(`/organizations/${orgId}/integrations`)).some(i => i.id === targetId);
if (!exists) throw new Error('Channel missing — refresh channel list'); Type guard
const isChannelOfOrg = (list: Integration[], id: string) => list.some(i => i.id === id);
Try / catch
try { await disable(id); } catch (e) { if (e.message === 'Function not found') await refreshChannels(); else throw e; } Prevention
- Refresh integration list before mutations
- Invalidate cached ids on channel delete/reconnect events
When it happens
Trigger: POST to an integration endpoint (e.g. /disable) with an 'id' that is not among the org's channels — stale id from another org, deleted channel, or typo'd/mangled request body.
Common situations: Client cached an old channel id after the channel was removed/reconnected; frontend sending id from a different organization; double-submit after deletion.
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/ee5b9ca22e592f71.
Report an issue: GitHub.