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 errors in toolkit authorize

haxzieb906c8667ed7
diff --git a/ts/examples/connected-accounts/src/magic-flow-demo.ts b/ts/examples/connected-accounts/src/magic-flow-demo.ts
index 88945e9e6..47e8dbf88 100644
--- a/ts/examples/connected-accounts/src/magic-flow-demo.ts
+++ b/ts/examples/connected-accounts/src/magic-flow-demo.ts
@@ -19,6 +19,8 @@ const connectionRequest = await composio.toolkits.authorize(userId, 'github');
// Redirect the user to continue to auth flow
const redirectUrl = connectionRequest.redirectUrl;
+console.log(`Redirect the user to ${redirectUrl}`);
+
// Wait for the user to connect the account / singin to GitHub
const connectedAccount = await connectionRequest.waitForConnection();
diff --git a/ts/packages/core/src/models/Toolkits.ts b/ts/packages/core/src/models/Toolkits.ts
index 0ea854459..2027400be 100644
--- a/ts/packages/core/src/models/Toolkits.ts
+++ b/ts/packages/core/src/models/Toolkits.ts
@@ -19,7 +19,7 @@ import { ComposioAuthConfigNotFoundError } from '../errors/AuthConfigErrors';
import { ConnectedAccounts } from './ConnectedAccounts';
import { ConnectionRequest } from './ConnectionRequest';
import { telemetry } from '../telemetry/Telemetry';
-import { AuthSchemeEnum, AuthSchemeType } from '../types/authConfigs.types';
+import { AuthConfigListResponse, AuthSchemeEnum, AuthSchemeType } from '../types/authConfigs.types';
import logger from '../utils/logger';
/**
* Toolkits class
@@ -380,6 +380,20 @@ export class Toolkits {
const authConfig = await composioAuthConfig.list({
toolkit: toolkitSlug,
});
+ if (authConfig.items?.length === 0) {
+ throw new ComposioAuthConfigNotFoundError(
+ `No auth configs found for toolkit ${toolkitSlug}`,
+ {
+ meta: {
+ toolkitSlug,
+ },
+ possibleFixes: [
+ `Please Create an auth config for the toolkit ${toolkitSlug} via the dashboard`,
+ ],
+ }
+ );
+ }
+
// pick the first auth config
authConfigIdToUse = authConfig.items[0]?.id;