Skip to content

Comments

fix(credentials): credential dependent endpoints#3309

Merged
icecrasher321 merged 6 commits intostagingfrom
fix/trigger-cred-resolution
Feb 23, 2026
Merged

fix(credentials): credential dependent endpoints#3309
icecrasher321 merged 6 commits intostagingfrom
fix/trigger-cred-resolution

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Feb 23, 2026

Summary

Dependent endpoints like Gmail Fetch label / Webhook external subscriptions should use new system helper to resolve credential id.

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 23, 2026 0:02am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 23, 2026

Greptile Summary

This PR fixes dependent endpoints (Gmail, Outlook, OneDrive, SharePoint, Wealthbox, Microsoft Planner, Vertex AI) to properly resolve credential IDs using the new resolveOAuthAccountId helper function.

Key Changes:

  • Exported resolveOAuthAccountId from apps/sim/app/api/auth/oauth/utils.ts to handle the new multi-credential system where a credentialId may reference either the new credential table or legacy account table
  • Updated 16 API endpoint routes to resolve credentials before querying the account table
  • Modified webhook polling services (Gmail, Outlook) and subscription management to use credential resolution
  • Refactored helper functions in provider-subscriptions.ts and renew-subscriptions/route.ts to return both userId and accountId after resolution
  • Added comprehensive error handling and logging for credential resolution failures

Minor Change:

  • Moved Credentials navigation item from 'tools' to 'account' section in settings modal

The implementation is consistent across all files, with proper null checks, error logging, and early returns when credential resolution fails.

Confidence Score: 5/5

  • Safe to merge - systematic refactor with consistent error handling
  • The PR implements a consistent pattern across all affected files by introducing resolveOAuthAccountId helper to handle the new credential system. All changes follow the same safe pattern: resolve credential ID, validate result, then use the resolved accountId. Error handling is comprehensive with proper logging and early returns on failures.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/api/auth/oauth/utils.ts Exported resolveOAuthAccountId helper function with documentation
apps/sim/lib/webhooks/utils.server.ts Added credential resolution in Teams, Airtable, Gmail, and Outlook webhook configurations
apps/sim/app/api/tools/gmail/label/route.ts Implemented credential resolution before fetching Gmail label
apps/sim/app/api/tools/gmail/labels/route.ts Simplified credential lookup logic with credential resolution
apps/sim/lib/webhooks/provider-subscriptions.ts Refactored getCredentialOwner to return both userId and accountId using credential resolution
apps/sim/lib/webhooks/gmail-polling-service.ts Added credential resolution in Gmail webhook polling with proper error handling
apps/sim/lib/webhooks/outlook-polling-service.ts Implemented credential resolution in Outlook webhook polling with error handling
apps/sim/executor/handlers/agent/agent-handler.ts Added credential resolution for Vertex AI credentials in agent handler

Last reviewed commit: e74a04a

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

25 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

bugbot run

@icecrasher321
Copy link
Collaborator Author

bugbot run

@icecrasher321
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@icecrasher321 icecrasher321 merged commit e55d41f into staging Feb 23, 2026
12 checks passed
@icecrasher321 icecrasher321 deleted the fix/trigger-cred-resolution branch February 23, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant