{"id":"1759edaab0940481","repo":"laravel/framework","slug":"pusher-error-s","errorCode":null,"errorMessage":"Pusher error: %s.","messagePattern":"Pusher error: (.+?)\\.","errorType":"exception","errorClass":"BroadcastException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php","lineNumber":171,"sourceCode":"     * @param  array  $payload\n     * @return void\n     *\n     * @throws \\Illuminate\\Broadcasting\\BroadcastException\n     */\n    public function broadcast(array $channels, $event, array $payload = [])\n    {\n        $socket = Arr::pull($payload, 'socket');\n\n        $parameters = $socket !== null ? ['socket_id' => $socket] : [];\n\n        $channels = new Collection($this->formatChannels($channels));\n\n        try {\n            $channels->chunk(100)->each(function ($channels) use ($event, $payload, $parameters) {\n                $this->pusher->trigger($channels->toArray(), $event, $payload, $parameters);\n            });\n        } catch (ApiErrorException $e) {\n            throw new BroadcastException(\n                sprintf('Pusher error: %s.', $e->getMessage())\n            );\n        }\n    }\n\n    /**\n     * Get the Pusher SDK instance.\n     *\n     * @return \\Pusher\\Pusher\n     */\n    public function getPusher()\n    {\n        return $this->pusher;\n    }\n\n    /**\n     * Set the Pusher SDK instance.\n     *","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php#L153-L189","documentation":"PusherBroadcaster::broadcast() catches a Pusher\\ApiErrorException raised by $this->pusher->trigger() and re-throws it as an Illuminate\\Broadcasting\\BroadcastException with the Pusher SDK message. It surfaces any Pusher-side API failure (auth, payload, rate limit) as a uniform broadcast failure.","triggerScenarios":"Dispatching a BroadcastEvent or calling broadcast() to a Pusher connection with bad cluster/app credentials, an event payload exceeding Pusher's 10240-byte limit, exceeding rate limits, or a transient network failure reaching the Pusher HTTP API.","commonSituations":"Wrong PUSHER_APP_ID/PUSHER_APP_KEY/PUSHER_APP_SECRET in .env. Pusher cluster mismatch (e.g. eu vs us-east). Large payloads (file contents in broadcast data). Production rate limiting after a traffic spike. Pusher plan limits exceeded.","solutions":["Verify PUSHER_APP_ID, PUSHER_APP_KEY, PUSHER_APP_SECRET, and PUSHER_APP_CLUSTER in .env match the Pusher dashboard.","Inspect the inner ApiErrorException message for the exact cause (auth, payload size, rate limit).","Reduce the event payload size; remove large or unserializable data from the broadcast payload.","Implement a retry with backoff for transient Pusher API errors, or catch BroadcastException to degrade gracefully."],"exampleFix":"// before\nbroadcast(new OrderShipped($order));\n\n// after\ntry {\n    broadcast(new OrderShipped($order));\n} catch (\\Illuminate\\Broadcasting\\BroadcastException $e) {\n    logger()->error('Pusher broadcast failed: '.$e->getMessage());\n    // optionally queue for retry\n}","handlingStrategy":"try-catch","validationCode":"// Validate Pusher config and payload before broadcasting\nif (strlen(json_encode($payload)) > 10240) {\n    throw new \\InvalidArgumentException('Broadcast payload exceeds Pusher 10KB limit.');\n}\n// Confirm credentials resolve\n$pusher = app(\\Pusher\\Pusher::class);","typeGuard":"// n/a - external service error","tryCatchPattern":"try {\n    broadcast(new OrderShipped($order));\n} catch (\\Illuminate\\Broadcasting\\BroadcastException $e) {\n    report($e);\n    // optionally queue a retry or notify monitoring\n}","preventionTips":["Keep broadcast payloads small; avoid sending full models.","Monitor Pusher rate-limit headers and back off.","Store Pusher credentials in secrets manager, not committed .env.","Add a global BroadcastException listener for graceful degradation."],"tags":["broadcasting","pusher","network","credentials","rate-limit"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}