Skip to content

Read only the type and credential when updating a connector - #1627

Merged
helpcodeai merged 1 commit into
mainfrom
fix/connector-update-select
Nov 11, 2026
Merged

helpcodeai merged 1 commit into
mainfrom
fix/connector-update-select

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

Saving a connector (for example PUT /api/connectors/:id/env-vars) loaded the whole connector twice, with every tool, resource and prompt. Sentry flagged it as an N+1 query (ANYTHINGMCP-CLOUD-BACKEND-E, sampled on 11-10). The second load is in ConnectorsService.update(), which only needs the connector's type and its stored credential.

Changes

  • update() reads { type, authConfig } with a select instead of calling findById (which includes tools, resources, prompts and server links).
  • A missing connector still throws the same NotFoundException.

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

  • Added/updated unit tests: connectors.service.auth-status.spec.ts checks the narrow select and the 404 for an unknown id; the existing auth-status and bearer tests still cover what existing is used for.
  • Tested manually (describe steps below)
  • No tests needed (explain why)

Backend CI runs the suite (the local Prisma client in my checkout is out of date).

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable)
  • All existing tests pass (npm test) (in CI)
  • This PR has a descriptive title

Cloud and self-hosted behave the same; no API or schema change.

Related Issues

Sentry ANYTHINGMCP-CLOUD-BACKEND-E

@helpcodeai
helpcodeai merged commit acb857c into main Nov 11, 2026
17 checks passed
@helpcodeai
helpcodeai deleted the fix/connector-update-select branch November 11, 2026 08:28
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant