{"record":{"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/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php#L153-L189","documentation":"PusherBroadcaster::broadcast wraps the Pusher SDK's trigger() call in a try/catch and re-throws any Pusher\\ApiErrorException as a BroadcastException with a descriptive message. The '%s' is the original Pusher SDK message. This is the single chokepoint through which all Pusher transport-level failures surface to application code.","triggerScenarios":"Calling event() or broadcast() that targets a Pusher-backed broadcast connection while: Pusher credentials (app key/secret/cluster) are wrong, the channel name violates Pusher naming rules, the payload exceeds Pusher size limits (10KB), the request hits Pusher rate limits, or the network cannot reach the Pusher API.","commonSituations":"Wrong PUSHER_APP_CLUSTER env value (e.g., 'mt1' vs 'us2'). Mismatched PUSHER_APP_KEY/PUSHER_APP_SECRET between environments. Payload containing large unserialized Eloquent models. Exceeding 100 messages per chunk boundary with malformed channel names. Staging credentials leaking into production.","solutions":["Verify PUSHER_APP_KEY, PUSHER_APP_SECRET, PUSHER_APP_ID, and PUSHER_APP_CLUSTER in .env match the Pusher dashboard values.","Reduce the broadcast payload size by selecting only needed attributes on models (e.g., $model->only(['id','name'])) and avoid serializing relations.","Catch \\Illuminate\\Broadcasting\\BroadcastException around broadcast() / event() calls and log/queue a retry for transient Pusher failures.","Validate channel names against Pusher's allowed pattern (max 200 chars, alphanumeric plus _-=,.@) before broadcasting."],"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', ['exception' => $e, 'order_id' => $order->id]);\n    throw $e;\n}","handlingStrategy":"try-catch","validationCode":"// Validate payload size and channel names before broadcasting\n$payload = (new \\Illuminate\\Broadcasting\\BroadcastEvent($event))->payload;\nif (strlen(json_encode($payload)) > 10_000) {\n    throw new \\RuntimeException('Pusher payload exceeds 10KB limit');\n}\nforeach ($channels as $channel) {\n    if (! preg_match('/^[a-zA-Z0-9_\\-=,.@:]{1,200}$/', $channel)) {\n        throw new \\RuntimeException(\"Invalid Pusher channel name: {$channel}\");\n    }\n}","typeGuard":null,"tryCatchPattern":"use Illuminate\\Broadcasting\\BroadcastException;\n\ntry {\n    broadcast($event);\n} catch (BroadcastException $e) {\n    if (str_contains($e->getMessage(), 'Pusher error')) {\n        // log Pusher-specific failure, surface alert\n        report($e);\n        return;\n    }\n    throw $e;\n}","preventionTips":["Keep Pusher credentials in sync across envs via a secrets manager; rotate on a schedule.","Cap broadcast payload size at the source — never broadcast full Eloquent models.","Wrap all broadcast() calls in a project helper that catches BroadcastException and reports.","Monitor Pusher dashboard error rate; align alert thresholds with broadcast volume."],"tags":["broadcasting","pusher","network","configuration"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}