Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(core): respect authConfigId in trigger subscriptions (#4298)

CoralGarden5252efb5b83368
diff --git a/.changeset/trigger-auth-config-filter.md b/.changeset/trigger-auth-config-filter.md
new file mode 100644
index 000000000..959343d0e
--- /dev/null
+++ b/.changeset/trigger-auth-config-filter.md
@@ -0,0 +1,5 @@
+---
+'@composio/core': patch
+---
+
+Fix trigger subscriptions ignoring the `authConfigId` filter.
diff --git a/ts/packages/core/src/models/Triggers.ts b/ts/packages/core/src/models/Triggers.ts
index ccf5dd764..e38ac7b36 100644
--- a/ts/packages/core/src/models/Triggers.ts
+++ b/ts/packages/core/src/models/Triggers.ts
@@ -558,6 +558,21 @@ export class Triggers<TProvider extends BaseComposioProvider<unknown, unknown, u
return false;
}
+ // Check if authConfigId filter matches.
+ // Only V3 trigger payloads (and the legacy TriggerData shape) carry an auth config id;
+ // V1/V2 payloads and non-trigger V3 events normalize it to '', so this filter drops
+ // those events entirely. This mirrors the Python SDK's `auth_config_id` filter.
+ if (
+ filters.authConfigId &&
+ filters.authConfigId !== data.metadata.connectedAccount.authConfigId
+ ) {
+ logger.debug(
+ 'Trigger does not match authConfigId filter',
+ JSON.stringify(filters.authConfigId, null, 2)
+ );
+ return false;
+ }
+
// Check if triggerName filter matches
if (
filters.triggerSlug?.length &&
diff --git a/ts/packages/core/test/models/triggers.test.ts b/ts/packages/core/test/models/triggers.test.ts
index 0fc81664d..c84c2710a 100644
--- a/ts/packages/core/test/models/triggers.test.ts
+++ b/ts/packages/core/test/models/triggers.test.ts
@@ -1251,6 +1251,16 @@ describe('Triggers', () => {
expect(logger.debug).toHaveBeenCalledWith('Parsed Pusher payload as V3 format');
});
+ it('should not call callback when V3 auth config does not match', async () => {
+ await triggers.subscribe(mockCallback, { authConfigId: 'auth-other' });
+ const subscribeCall = vi.mocked(mockPusherService.subscribe).mock.calls[0];
+ const filterCallback = subscribeCall[0];
+
+ filterCallback(mockV3Payload);
+
+ expect(mockCallback).not.toHaveBeenCalled();
+ });
+
it('should parse V2 Pusher payload', async () => {
await triggers.subscribe(mockCallback);
const subscribeCall = vi.mocked(mockPusherService.subscribe).mock.calls[0];