Skip to content

admin: GET /api/integrations/admin/all 500s — populate('platformIntegration') names models that are not registered #1672

Closed

Description

@lilyshen0722

Seen live on 46e84197 (2026-09-11, UI smoke as an admin account): the admin Apps management list (frontend/src/components/AppsManagement.tsx:153 → GET /api/integrations/admin/all) answers 500 {"message":"Server error"}. Backend log, four times in the sweep:

Error fetching all integrations: MissingSchemaError: Schema hasn't been registered for model "TelegramIntegration".

Cause. backend/routes/integrations.ts:500 does Integration.find({ isActive: true }).populate('podId', …).populate('createdBy', …).populate('platformIntegration'). platformIntegration is a virtual (backend/models/Integration.ts:343) whose ref() maps telegram → 'TelegramIntegration', slack → 'SlackIntegration', discord → 'DiscordIntegration', messenger → 'MessengerIntegration'. None of those models is registered anywhere in backend/ (git grep "mongoose.model('TelegramIntegration'" → nothing), so the first Telegram row makes Mongoose throw. The mapping came in with the Slack connector (#1537 via the TS migration) and nothing registers the referenced models, so the route has been 500ing since there was a Telegram row to populate.

Not from today's deploy — #1668 touched server.ts mount order and routes/grants.ts only; the failing route and virtual are untouched since #1662.

Fix (Connectors lane's call). Either drop .populate('platformIntegration') from /admin/all (the D8 connector model keeps its platform state in config, so the virtual has nothing to join), or delete the virtual outright if no other read uses it. A route test that seeds one telegram row and expects 200 pins it.

Repro. As an admin: curl -s -o /dev/null -w '%{http_code}' https://api.commonly.me/api/integrations/admin/all -H "x-auth-token: <admin jwt>" → 500.

Other smoke tallies on the same build for context: Direction C 45/47 (+2 NA), kernel 77/80 (the 3 are the smoke account's own hosted cap), UI 25/31 — the two non-account FAILs are this 500 and a pre-#1653 placeholder description on an existing seat (decision card 67303).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions