{"record":{"id":"bc5bd5e8f09c893f","repo":"ComposioHQ/composio","slug":"pusher-connection-error-err-message","errorCode":null,"errorMessage":"Pusher connection error: ${err.message}","messagePattern":"Pusher connection error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"ts/packages/core/src/utils/pusher.ts","lineNumber":101,"sourceCode":"                  try {\n                    callback(null, JSON.parse(data));\n                  } catch (e) {\n                    logger.error('Failed to parse auth response:', e);\n                    callback(new Error('Invalid auth response format'), null);\n                  }\n                })\n                .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(","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/utils/pusher.ts#L83-L119","documentation":"The Composio SDK's realtime trigger client (pusher-js) fires a connection 'error' event while establishing or maintaining its websocket connection to the Pusher cluster. The handler in getPusherClient rethrows it as 'Pusher connection error'. This indicates a websocket-level connectivity problem, not an issue with your Composio API key.","triggerScenarios":"Calling an API that initializes realtime triggers (e.g. Composio.getPusherClient(baseURL, apiKey) or trigger subscription flows) when the environment cannot reach the Pusher cluster (ws://*.pusher.com:443) — blocked ports, restrictive corporate firewalls, offline/sandboxed CI, or an invalid/expired Pusher key/cluster configuration.","commonSituations":"CI containers with egress allowlists that only permit the Composio API domain; running in Docker without network access; proxies that block websockets; ad-blockers or network policies on the developer machine.","solutions":["Verify outbound websocket connectivity to the Pusher cluster (cluster mt1) on port 443 from your environment","If behind a corporate proxy/firewall, allowlist *.pusher.com or configure a websocket-capable proxy for pusher-js","Retry in a network-open environment (e.g. local machine) to confirm it's environmental","Check for an SDK version update — the Pusher key is bundled (CLIENT_PUSHER_KEY) and an outdated SDK may carry a stale key"],"exampleFix":"// before: running in locked-down CI\nawait PusherUtils.getPusherClient(baseURL, apiKey);\n\n// after: guard the call\ntry {\n  await PusherUtils.getPusherClient(baseURL, apiKey);\n} catch (e) {\n  console.warn('Realtime triggers unavailable, falling back to polling', e);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await PusherUtils.getPusherClient(baseURL, apiKey);\n} catch (e) {\n  // realtime is optional for many flows; degrade gracefully\n  logger.warn('Realtime triggers unavailable:', e instanceof Error ? e.message : e);\n}","preventionTips":["Verify websocket egress to *.pusher.com:443 in Docker/CI before enabling triggers","Treat realtime triggers as optional: catch init failures and fall back to polling","Test trigger flows in a network-open environment first"],"tags":["pusher","websocket","realtime","network","triggers"],"backgroundTag":"websocket-connection-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}