Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Failed to connect to Pusher. #507

Closed
faustbrian opened this issue Sep 6, 2020 · 11 comments
Closed

Failed to connect to Pusher. #507

faustbrian opened this issue Sep 6, 2020 · 11 comments

Comments

@faustbrian
Copy link
Contributor

faustbrian commented Sep 6, 2020

Trying at the moment to get the WebSockets working as a replacement for Pusher but I always receive the error message Failed to connect to Pusher. when trying to follow the steps in https://beyondco.de/docs/laravel-websockets/basic-usage/pusher#pusher-configuration.

        'pusher' => [
            'driver'  => 'pusher',
            'key'     => env('PUSHER_APP_KEY'),
            'secret'  => env('PUSHER_APP_SECRET'),
            'app_id'  => env('PUSHER_APP_ID'),
            'options' => [
                'cluster'      => env('PUSHER_APP_CLUSTER'),
                'useTLS'       => true,
                'host'         => 'valet.host',
                'port'         => 6001,
                'scheme'       => 'https',
                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => env('APP_ENV') !== 'local',
                    CURLOPT_SSL_VERIFYPEER => env('APP_ENV') !== 'local',
                ],
            ],
        ],

Is there any configuration that I am overlooking or misusing? Normal pusher works fine and the WebSockets are also running without issues.

@rennokki
Copy link
Collaborator

rennokki commented Sep 6, 2020

Perhaps you need to set the scheme to http if you don't use SSL.

@faustbrian
Copy link
Contributor Author

I am using HTTPS both with Valet and the production system and configured the SSL certificates.

@rennokki
Copy link
Collaborator

rennokki commented Sep 6, 2020

Having self-signed certificates need the curl_options to have them set to true.

@faustbrian
Copy link
Contributor Author

faustbrian commented Sep 6, 2020

Tried that before and tried it again but that results in the same issue.

// With curl_options explicitly set to true
            'options' => [
                'cluster'      => env('PUSHER_APP_CLUSTER'),
                'useTLS'       => true,
                'host'         => 'valet.host',
                'port'         => 6001,
                'scheme'       => 'https',
                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => true,
                    CURLOPT_SSL_VERIFYPEER => true,
                ],
            ],

// Without curl_options, letting it use defaults
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'useTLS'  => true,
                'host'    => 'valet.host',
                'port'    => 6001,
                'scheme'  => 'https',
            ],

Also tried to set useTLS to false to avoid wrong ports but the same issue persists.

@rennokki
Copy link
Collaborator

rennokki commented Sep 6, 2020

Sorry for disorienting you, but values should be false so they won't check for additional SSL verifications.

@faustbrian
Copy link
Contributor Author

That's what the behaviour at the moment is when I run it locally because I use env('APP_ENV') !== 'local' which will only enable the SSL checks in production/staging.

@rennokki
Copy link
Collaborator

rennokki commented Sep 6, 2020

Is your websockets server running?

@faustbrian
Copy link
Contributor Author

faustbrian commented Sep 6, 2020

Yeah, when I manually post it I can see that it receives the requests by throwing an error because I am omitting the signature.

>>> https://valet.test:6001/apps/ID/events
Starting the WebSocket server on port 6001...
Exception `Symfony\Component\HttpKernel\Exception\HttpException` thrown: `Invalid auth signature provided.`
Exception `Symfony\Component\HttpKernel\Exception\HttpException` thrown: `Invalid auth signature provided.`
Exception `Symfony\Component\HttpKernel\Exception\HttpException` thrown: `Invalid auth signature provided.`

Requests from broadcasted events never seem to even hit the server even though it uses the correct URL to post to.

@faustbrian
Copy link
Contributor Author

Based on some logging it looks like auth_signature is always empty and thus a 401 is thrown which is just being swallowed into a generic request failure without more details.

@faustbrian
Copy link
Contributor Author

Looks like this is a known issue with the combination of Valet, Guzzle and curl laravel/valet#736 (comment).

@ziagit
Copy link

ziagit commented Feb 11, 2021

I had the same problem, websockets was not running in the server, run: php artisan websockets:serve

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants