itsjeffro / deploy

Laravel package for zero-downtime deployments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Illuminate\Broadcasting\BroadcastException Deploy\Events\ServerConnectionTested

paulycloud opened this issue · comments

Hey @itsjeffro

We're on our way to create the most awesome zero downtime deployment tool out there.

But first :)

Illuminate\Broadcasting\BroadcastException
vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:119 Illuminate\Broadcasting\Broadcasters\PusherBroadcaster::broadcast
vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php:48 Illuminate\Broadcasting\BroadcastEvent::handle
[internal] call_user_func_array
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32 Illuminate\Container\BoundMethod::Illuminate\Container{closure}
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:90 Illuminate\Container\BoundMethod::callBoundMethod
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:34 Illuminate\Container\BoundMethod::call
vendor/laravel/framework/src/Illuminate/Container/Container.php:576 Illuminate\Container\Container::call
vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:94 Illuminate\Bus\Dispatcher::Illuminate\Bus{closure}
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline{closure}
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 Illuminate\Pipeline\Pipeline::then
vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:98 Illuminate\Bus\Dispatcher::dispatchNow
vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:49 Illuminate\Queue\CallQueuedHandler::call
vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:88 Illuminate\Queue\Jobs\Job::fire
vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php:42 Illuminate\Queue\SyncQueue::push
vendor/laravel/framework/src/Illuminate/Queue/Queue.php:44 Illuminate\Queue\Queue::pushOn
vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php:128 Illuminate\Broadcasting\BroadcastManager::queue
vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:267 Illuminate\Events\Dispatcher::broadcastEvent
vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:190 Illuminate\Events\Dispatcher::dispatch
vendor/itsjeffro/deploy/src/Processors/ServerConnectionProcessor.php:74 Deploy\Processors\ServerConnectionProcessor::fire
vendor/itsjeffro/deploy/src/Jobs/TestConnectionJob.php:41 Deploy\Jobs\TestConnectionJob::handle
[internal] call_user_func_array
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32 Illuminate\Container\BoundMethod::Illuminate\Container{closure}
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:90 Illuminate\Container\BoundMethod::callBoundMethod
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:34 Illuminate\Container\BoundMethod::call
vendor/laravel/framework/src/Illuminate/Container/Container.php:576 Illuminate\Container\Container::call
vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:94 Illuminate\Bus\Dispatcher::Illuminate\Bus{closure}
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline{closure}
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 Illuminate\Pipeline\Pipeline::then
vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:98 Illuminate\Bus\Dispatcher::dispatchNow
vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:49 Illuminate\Queue\CallQueuedHandler::call
vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:88 Illuminate\Queue\Jobs\Job::fire
vendor/laravel/framework/src/Illuminate/Queue/Worker.php:337 Illuminate\Queue\Worker::process
vendor/laravel/framework/src/Illuminate/Queue/Worker.php:283 Illuminate\Queue\Worker::runJob
vendor/laravel/framework/src/Illuminate/Queue/Worker.php:118 Illuminate\Queue\Worker::daemon
vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:102 Illuminate\Queue\Console\WorkCommand::runWorker
vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:86 Illuminate\Queue\Console\WorkCommand::handle
[internal] call_user_func_array
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32 Illuminate\Container\BoundMethod::Illuminate\Container{closure}
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:90 Illuminate\Container\BoundMethod::callBoundMethod
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:34 Illuminate\Container\BoundMethod::call
vendor/laravel/framework/src/Illuminate/Container/Container.php:576 Illuminate\Container\Container::call
vendor/laravel/framework/src/Illuminate/Console/Command.php:183 Illuminate\Console\Command::execute
vendor/symfony/console/Command/Command.php:255 Symfony\Component\Console\Command\Command::run
vendor/laravel/framework/src/Illuminate/Console/Command.php:170 Illuminate\Console\Command::run
vendor/symfony/console/Application.php:1000 Symfony\Component\Console\Application::doRunCommand
vendor/symfony/console/Application.php:271 Symfony\Component\Console\Application::doRun
vendor/symfony/console/Application.php:147 Symfony\Component\Console\Application::run
vendor/laravel/framework/src/Illuminate/Console/Application.php:90 Illuminate\Console\Application::run
vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:133 Illuminate\Foundation\Console\Kernel::handle
artisan:37 [main]

@paulycloud hah noice!

Hmm, i know you mentioned you were using laravel 5.8 which ive used as well.

What version of pusher are you using?

Ahh. Good question. I have "pusher/pusher-php-server": "^4.1" in my composer.json.

I'm downgrading now and trying with the exact version specified.

Ah ok. Just in case that doesnt work. What version of php is your server running on as well?

The closer i cant get to repliacting it, the better

I downgraded to pusher 4.1. My PHP version is PHP 7.4.6. Still seeing the error.

I'm available for a video chat if you'd like. Let me know.

@paulycloud
We might have to try a call another time. Im heading to work in a little bit.

Ill try replicating this with 7.4 as ive only tested up to 7.3. Also, i might try replacing the DI event dispatcher as well with just event()

@itsjeffro
Gotcha. No worries. I am committed to getting this to work flawlessly!! :)

Heya @paulycloud

I was just having a look at the message that BroadcastException should be throwing in vendor\laravel\framework\src\Illuminate\Broadcasting\Broadcasters\PusherBroadcaster.php

There should be a "message" or a "response" from pusher that should be getting logged. Did you happen to see anything like that in your logs?

Based on the logic in PusherBroadcaster.php that exception will be thrown if the status is not between 200 and 299. So there may be some issues with the credentials or cannot reach pusher.

Hey. I didn't see that message but from the "notifications" section on the dashboard, here's what i'm seeing:

I'm researching this now as I type.

image

Heya @paulycloud

It might be worth double checking that the keys are in the storage/app/keys directory and that the correct permissions are there for your forge user

As for the pusher/broadcast issue, i managed to reproduce a similar issue with the same stack trace. This is due to the pusher timestamp server timestamp being 600ms or s different from the actual time.

So you might need:

  1. to ssh into your server that has deploy
  2. run date and check the time and timezone
  3. Make sure the time and timezone are correct. Google the actual time zone and make sure there are no differences.

https://support.pusher.com/hc/en-us/articles/360019023674-What-does-the-Timestamp-expired-response-from-REST-API-mean-when-triggering-an-event-

@paulycloud

In regards to the chmod issue. If i recall correctly, i think i saw that you had your deploy app's storage directory symlinked. If thats correct, then it looks like php chmod doesnt really work well with symlinked files from the app.

Thats probably why it only started working once we changed the keys directory permissions directly in the server during our chat.

Heya @paulycloud Just accepted the google invite. Chat with you on Saturday:)

Sweet! Can't wait!

We'll create a Spartan out of this package. 😂

I know why the sever keys weren't added, we did not include the public key in the authorized users file!!!!!!!!

heya @paulycloud

I know why the sever keys weren't added, we did not include the public key in the authorized users file!!!!!!!!

the private key from the key pairs still needs to be created on the server that handles the deployments :)

anyway, i've pushed up an update so the file creation uses the filesystem class. let me know how that goes.

don't forget to run php artisan queue:restart.

Haha! Pulling in the latest version now!! 😂

Server connection successful. Closing ticket. 😊

Way to go, @paulycloud :)