laravel/framework · error · BroadcastException
Pusher error: %s.
Error message
Pusher error: %s.
What it means
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.
Source
Thrown at src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:171
* @param array $payload
* @return void
*
* @throws \Illuminate\Broadcasting\BroadcastException
*/
public function broadcast(array $channels, $event, array $payload = [])
{
$socket = Arr::pull($payload, 'socket');
$parameters = $socket !== null ? ['socket_id' => $socket] : [];
$channels = new Collection($this->formatChannels($channels));
try {
$channels->chunk(100)->each(function ($channels) use ($event, $payload, $parameters) {
$this->pusher->trigger($channels->toArray(), $event, $payload, $parameters);
});
} catch (ApiErrorException $e) {
throw new BroadcastException(
sprintf('Pusher error: %s.', $e->getMessage())
);
}
}
/**
* Get the Pusher SDK instance.
*
* @return \Pusher\Pusher
*/
public function getPusher()
{
return $this->pusher;
}
/**
* Set the Pusher SDK instance.
*View on GitHub (pinned to bd6b5437e6)
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.
Example fix
// before
broadcast(new OrderShipped($order));
// after
try {
broadcast(new OrderShipped($order));
} catch (\Illuminate\Broadcasting\BroadcastException $e) {
logger()->error('Pusher broadcast failed: '.$e->getMessage());
// optionally queue for retry
} Defensive patterns
Strategy: try-catch
Validate before calling
// Validate Pusher config and payload before broadcasting
if (strlen(json_encode($payload)) > 10240) {
throw new \InvalidArgumentException('Broadcast payload exceeds Pusher 10KB limit.');
}
// Confirm credentials resolve
$pusher = app(\Pusher\Pusher::class); Type guard
// n/a - external service error
Try / catch
try {
broadcast(new OrderShipped($order));
} catch (\Illuminate\Broadcasting\BroadcastException $e) {
report($e);
// optionally queue a retry or notify monitoring
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to create broadcaster for connection "{$name}" with e
- Ably error: %s
- Redis error: %s.
- Broadcast connection [{$name}] is not defined.
- Driver [{$config['driver']}] is not supported.
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/1759edaab0940481.json.
Report an issue: GitHub.