Laravel pusher Error – Help needed to interpret the error message
I am using laravel 5.8, and using laravel pusher "^4.1". Laravel pusher was working fine before 2 days ago. On, that day I had updated laravel composer and global laravel/installer to install new (another) laravel app. And, today when I am testing the old app the laravel pusher is not working. It is throwing following error:
Illuminate\Broadcasting\BroadcastException in D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Broadcasting\Broadcasters\PusherBroadcaster.php:119 Stack trace: #0 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastEvent.php(48): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster->broadcast(Array, 'amenity-uploade...', Array) #1 [internal function]: Illuminate\Broadcasting\BroadcastEvent->handle(Object(Illuminate\Broadcasting\Broadcasters\PusherBroadcaster)) #2 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(32): call_user_func_array(Array, Array) #3 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #4 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #5 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #6 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(94): Illuminate\Container\Container->call(Array) #7 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Broadcasting\BroadcastEvent)) #8 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Broadcasting\BroadcastEvent)) #9 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #10 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Broadcasting\BroadcastEvent), false) #11 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(88): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array) #12 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(337): Illuminate\Queue\Jobs\Job->fire() #13 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(283): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions)) #14 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions)) #15 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(102): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions)) #16 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default') #17 [internal function]: Illuminate\Queue\Console\WorkCommand->handle() #18 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(32): call_user_func_array(Array, Array) #19 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #20 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #21 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Container\Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #22 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Console\Command.php(183): Illuminate\Container\Container->call(Array) #23 D:\wamp64\www\amenity\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #24 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Console\Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #25 D:\wamp64\www\amenity\vendor\symfony\console\Application.php(1012): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #26 D:\wamp64\www\amenity\vendor\symfony\console\Application.php(272): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #27 D:\wamp64\www\amenity\vendor\symfony\console\Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #28 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Console\Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #29 D:\wamp64\www\amenity\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(133): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #30 D:\wamp64\www\amenity\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #31 {main}
My event file looks like:
class AmenityUploaded implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; public $property_id; /** * Create a new event instance. * * AmenityUploaded constructor. * @param $property_id */ public function __construct($property_id) { $this->property_id = $property_id; } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { // return new PrivateChannel('channel.amenity.'.$this->property_id); return ['channel.amenity']; } public function broadcastAs() { return 'amenity-uploaded'; } public function broadcastWith() { // This must always be an array. Since it will be parsed with json_encode() $prop = Property::find($this->property_id); $trash = ""; $warning = ""; if($prop->completed == 1){ $main = "<a href='".url('/admin/floor-stack/?company='.$prop->company_id.'&property='.$this->property_id)."' class='btn btn-xs btn-primary d-inline-block mr-1'>View</a>"; $trash = "<a href='#' class='btn btn-xs bg-light-grey delete_amenity mr-1'><i class='fa fa-trash text-white' aria-hidden='true'></i></a>"; }elseif($prop->completed == 2){ $main = "<a href='#' class='btn btn-xs btn-warning d-inline-block mr-1'>Pending</a>"; }elseif($prop->completed == 3){ $notice = Notice::where('property_id',$this->property_id)->where('file_type','1')->first(); $main = "<a href='".url('/admin/floor-stack/?company='.$prop->company_id.'&property='.$this->property_id)."' class='btn btn-xs btn-primary d-inline-block mr-1'>View</a>"; $trash = "<a href='#' class='btn btn-xs bg-light-grey delete_amenity'><i class='fa fa-trash text-white' aria-hidden='true'></i></a>"; $warning = "<a class='d-inline-block' href='".url('/admin/notice/'.$notice->slug)."' data-toggle='tooltip' data-html='true' title='The upload has some potential errors. Please click here to check which errors were detected.'><i class='fa fa-exc fa-exclamation-circle text-warning align-middle' aria-hidden='true'></i></a>"; }else{ $main = "<a href='".url('/admin/property/create/'.$this->property_id)."' class='btn btn-xs btn-secondary d-inline-block mr-1'><i class='fa fa-arrow-circle-up' aria-hidden='true'></i> Upload</a>"; } return [ 'id' => $this->property_id, 'main' => $main, 'trash' => $trash, 'warning' => $warning ]; } }
channel subsription
var pusher = new Pusher("{{config('broadcasting.connections.pusher.key')}}", { cluster: 'us3', forceTLS: true }); /** channel.amenity **/ let channelAmenity = pusher.subscribe(`channel.amenity`); channelAmenity.bind('amenity-uploaded', function(data) { // console.log(data); $('#am_div_'+data.id).html(data.main+data.trash+' '+data.warning); });
And, event is being fired from a laravel job as :
event(new AmenityUploaded($this->data['property_id']));
It just changed the status of a laravel job from running to completed.
If you need any further details, let me know.