{"record":{"id":"a86c0588e07a5504","repo":"ComposioHQ/composio","slug":"failed-to-initialize-pusher-client-errormessage","errorCode":null,"errorMessage":"Failed to initialize Pusher client: ${errorMessage}","messagePattern":"Failed to initialize Pusher client: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/utils/pusher.ts","lineNumber":108,"sourceCode":"                .catch((error: unknown) => {\n                  logger.error('Pusher auth request failed:', error);\n                  callback(error instanceof Error ? error : new Error(String(error)), null);\n                });\n            },\n          },\n        });\n\n        // Add connection error handling\n        PusherUtils.pusherClient.connection.bind('error', (err: Error) => {\n          logger.error('Pusher connection error:', err);\n          throw new Error(`Pusher connection error: ${err.message}`);\n        });\n      }\n      return PusherUtils.pusherClient;\n    } catch (error: unknown) {\n      const errorMessage = error instanceof Error ? error.message : String(error);\n      logger.error('Failed to initialize Pusher client:', error);\n      throw new Error(`Failed to initialize Pusher client: ${errorMessage}`);\n    }\n  }\n\n  /**\n   * Subscribes to a Pusher channel and binds an event to a callback function.\n   * @param {string} channelName - The name of the channel to subscribe to.\n   * @param {string} event - The event to bind to the channel.\n   * @param {(data: Record<string, unknown>) => void} fn - The callback function to execute when the event is triggered.\n   * @returns {PusherClient} The Pusher client instance.\n   */\n  static async subscribe(\n    channelName: string,\n    event: string,\n    fn: (data: Record<string, unknown>) => void\n  ): Promise<void> {\n    try {\n      await PusherUtils.pusherClient.subscribe(channelName).bind(event, fn);\n    } catch (error) {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/utils/pusher.ts#L90-L126","documentation":"A catch-all thrown when initializing the pusher-js realtime client fails for any reason (import failure, constructor error, auth handler misconfiguration). The underlying cause is appended to the message. It wraps every synchronous failure inside getPusherClient.","triggerScenarios":"Calling getPusherClient(baseURL, apiKey) when the dynamic import('pusher-js') fails (package not installed/bundled in edge runtimes), when baseURL/apiKey are malformed so the auth endpoint URL is invalid, or when the PusherClient constructor throws.","commonSituations":"Bundlers that break the dynamic pusher-js import; missing pusher-js dependency in a custom build; passing an empty or malformed baseURL; SSR/edge environments where pusher-js cannot construct a websocket client.","solutions":["Check the appended underlying message — it names the real cause","Ensure pusher-js is installed and resolvable in your bundle (check dynamic import support in your bundler/runtime)","Verify baseURL and apiKey passed to the SDK are valid, non-empty strings","If in a non-browser environment, ensure a websocket implementation is available or avoid realtime trigger APIs"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!baseURL?.startsWith('http') || !apiKey) throw new Error('baseURL/apiKey required');","typeGuard":null,"tryCatchPattern":"try {\n  return await PusherUtils.getPusherClient(baseURL, apiKey);\n} catch (e) {\n  throw new Error(`Realtime init failed: ${e instanceof Error ? e.message : String(e)}`);\n}","preventionTips":["Always pass valid baseURL and apiKey to SDK initialization","Verify pusher-js resolves in your bundle after bundler config changes","Surface the appended underlying message in your error reporting"],"tags":["pusher","initialization","realtime","typescript"],"backgroundTag":"client-initialization-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}