laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
1.02k stars 71 forks source link

Using ssl in valet environment causes error. #163

Closed jksa closed 4 months ago

jksa commented 4 months ago

Reverb Version

1.0.0-beta7

Laravel Version

11.4.0

PHP Version

8.2.16

Description

I have struggled to get laravel reverb work locally with valet & ssl & Livewire.

I can get Echo successfully connet to reverb, but when dispatching event, I get error:

[2024-04-19 10:17:12] local.ERROR: cURL error 56: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0

Steps To Reproduce

I use node version 20.10. Valet version: 4.6.1

composer create-project laravel/laravel reverb-app
cd reverb-app
valet link --secure
composer require laravel/breeze --dev
php artisan breeze:install
   -> Livewire (Volt Class API) with Alpine -> No -> phpunit
php artisan install:broadcasting
  -> Yes, install reverb...
  -> Would you like to install and build the Node dependencies required for broadcasting? Yes.

Change from .env: APP_URL=https://reverb-app.test REVERB_HOST="reverb-app.test" REVERB_SCHEME=https

Set reverb.cong tls option to:

'tls' => [
   'verify_peer' => false,
   'allow_self_signed' => true,
],

Create TestEvent for broadcasting: php artisan make:event TestEvent Edit TestEvet to implement ShouldBroadcast and chane PrivateChannel to Channel

Start parallel: npm run dev php artisan reverb:start --debug php artisan queue:work

Check browser connects successfully and reverb debug shows connection.

Dispatch event from tinker: App\Events\TestEvent::dispatch();

See error from logs: [2024-04-19 10:48:14] local.ERROR: cURL error 56: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0

Full trace [2024-04-19 10:48:14] local.ERROR: cURL error 56: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://reverb-app.test:8080/apps/835917/events?auth_key=bkefoajmyavya3ph3lml&auth_timestamp=1713523694&auth_version=1.0&body_md5=290a36791f069f26dc79082e40601c21&auth_signature=ff9d675c3f35a20b31e8dc9d106d3d6dd8f9208749641316f0be6c9aca044b8f {"exception":"[object] (GuzzleHttp\\Exception\\RequestException(code: 0): cURL error 56: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://reverb-app.test:8080/apps/835917/events?auth_key=bkefoajmyavya3ph3lml&auth_timestamp=1713523694&auth_version=1.0&body_md5=290a36791f069f26dc79082e40601c21&auth_signature=ff9d675c3f35a20b31e8dc9d106d3d6dd8f9208749641316f0be6c9aca044b8f at /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:211) [stacktrace] #0 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(158): GuzzleHttp\\Handler\\CurlFactory::createRejection(Object(GuzzleHttp\\Handler\\EasyHandle), Array) #1 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(110): GuzzleHttp\\Handler\\CurlFactory::finishError(Object(GuzzleHttp\\Handler\\CurlHandler), Object(GuzzleHttp\\Handler\\EasyHandle), Object(GuzzleHttp\\Handler\\CurlFactory)) #2 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(47): GuzzleHttp\\Handler\\CurlFactory::finish(Object(GuzzleHttp\\Handler\\CurlHandler), Object(GuzzleHttp\\Handler\\EasyHandle), Object(GuzzleHttp\\Handler\\CurlFactory)) #3 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\\Handler\\CurlHandler->__invoke(Object(GuzzleHttp\\Psr7\\Request), Array) #4 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(48): GuzzleHttp\\Handler\\Proxy::GuzzleHttp\\Handler\\{closure}(Object(GuzzleHttp\\Psr7\\Request), Array) #5 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(64): GuzzleHttp\\Handler\\Proxy::GuzzleHttp\\Handler\\{closure}(Object(GuzzleHttp\\Psr7\\Request), Array) #6 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\\Psr7\\Request), Array) #7 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\\Middleware::GuzzleHttp\\{closure}(Object(GuzzleHttp\\Psr7\\Request), Array) #8 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\\RedirectMiddleware->__invoke(Object(GuzzleHttp\\Psr7\\Request), Array) #9 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\\Middleware::GuzzleHttp\\{closure}(Object(GuzzleHttp\\Psr7\\Request), Array) #10 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Client.php(333): GuzzleHttp\\HandlerStack->__invoke(Object(GuzzleHttp\\Psr7\\Request), Array) #11 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Client.php(169): GuzzleHttp\\Client->transfer(Object(GuzzleHttp\\Psr7\\Request), Array) #12 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/Client.php(189): GuzzleHttp\\Client->requestAsync('POST', Object(GuzzleHttp\\Psr7\\Uri), Array) #13 /Users/juser/code/reverb-app/vendor/guzzlehttp/guzzle/src/ClientTrait.php(95): GuzzleHttp\\Client->request('POST', 'apps/835917/eve...', Array) #14 /Users/juser/code/reverb-app/vendor/pusher/pusher-php-server/src/Pusher.php(776): GuzzleHttp\\Client->post('apps/835917/eve...', Array) #15 /Users/juser/code/reverb-app/vendor/pusher/pusher-php-server/src/Pusher.php(441): Pusher\\Pusher->post('/apps/835917/ev...', '{\"name\":\"App\\\\\\\\E...') #16 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php(161): Pusher\\Pusher->trigger(Array, 'App\\\\Events\\\\Test...', Array, Array) #17 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(237): Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster->Illuminate\\Broadcasting\\Broadcasters\\{closure}(Object(Illuminate\\Support\\Collection), 0) #18 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php(160): Illuminate\\Support\\Collection->each(Object(Closure)) #19 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(92): Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster->broadcast(Object(Illuminate\\Support\\Collection), 'App\\\\Events\\\\Test...', Array) #20 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Broadcasting\\BroadcastEvent->handle(Object(Illuminate\\Broadcasting\\BroadcastManager)) #21 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() #22 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure)) #23 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure)) #24 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL) #25 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call(Array) #26 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(Illuminate\\Broadcasting\\BroadcastEvent)) #27 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Broadcasting\\BroadcastEvent)) #28 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then(Object(Closure)) #29 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(Illuminate\\Broadcasting\\BroadcastEvent), false) #30 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}(Object(Illuminate\\Broadcasting\\BroadcastEvent)) #31 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Broadcasting\\BroadcastEvent)) #32 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Pipeline\\Pipeline->then(Object(Closure)) #33 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(71): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(Illuminate\\Broadcasting\\BroadcastEvent)) #34 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Array) #35 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(439): Illuminate\\Queue\\Jobs\\Job->fire() #36 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(389): Illuminate\\Queue\\Worker->process('database', Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(Illuminate\\Queue\\WorkerOptions)) #37 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(176): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), 'database', Object(Illuminate\\Queue\\WorkerOptions)) #38 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(139): Illuminate\\Queue\\Worker->daemon('database', 'default', Object(Illuminate\\Queue\\WorkerOptions)) #39 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(122): Illuminate\\Queue\\Console\\WorkCommand->runWorker('database', 'default') #40 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle() #41 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() #42 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure)) #43 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure)) #44 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL) #45 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\\Container\\Container->call(Array) #46 /Users/juser/code/reverb-app/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle)) #47 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle)) #48 /Users/juser/code/reverb-app/vendor/symfony/console/Application.php(1049): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #49 /Users/juser/code/reverb-app/vendor/symfony/console/Application.php(318): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Queue\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #50 /Users/juser/code/reverb-app/vendor/symfony/console/Application.php(169): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #51 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #52 /Users/juser/code/reverb-app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1183): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #53 /Users/juser/code/reverb-app/artisan(13): Illuminate\\Foundation\\Application->handleCommand(Object(Symfony\\Component\\Console\\Input\\ArgvInput)) #54 {main} "}
joedixon commented 4 months ago

@jksa we pushed a fix for Valet yesterday. Could you maybe try the main branch by requesting "laravel/reverb":"@dev" in your composer.json?

You'll need to remove all TLS options from your config to test.

jksa commented 4 months ago

Installed and removed all tls options. Same error.

Reverb version is now:

composer show -i laravel/reverb

name : laravel/reverb descrip. : Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications. keywords : WebSockets, laravel, real-time, websocket versions : * dev-main . . .

joedixon commented 4 months ago

Hey @jksa I believe this is an issue with Curl on your local machine. If you can supply a repo reproducing the issue, I'm happy to test on my local machine. You can get started with the following command:

laravel new bug-report --github="--public"

Going to close this issue in the mean time.

jksa commented 4 months ago

https://github.com/jksa/laravel-reverb-ssl-issue

jksa commented 4 months ago

Hi @joedixon , please feel free to test with my repo. Today I updated php & curl versions and still got same issue. Can you please inform me what cURL version you are using? I tried also with PHP8.3.6 but same error. Curl has version 8.4.0

Here is my env file:

env APP_NAME=Laravel APP_ENV=local APP_KEY=base64:xphd5PuSjc3qy4M9uqJ0XZUSPvOSEHtNZtx3CcyD7+w= APP_DEBUG=true APP_TIMEZONE=UTC APP_URL=https://laravel-reverb-ssl-issue.test APP_LOCALE=en APP_FALLBACK_LOCALE=en APP_FAKER_LOCALE=en_US APP_MAINTENANCE_DRIVER=file APP_MAINTENANCE_STORE=database BCRYPT_ROUNDS=12 LOG_CHANNEL=stack LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=sqlite # DB_HOST=127.0.0.1 # DB_PORT=3306 # DB_DATABASE=laravel # DB_USERNAME=root # DB_PASSWORD= SESSION_DRIVER=database SESSION_LIFETIME=120 SESSION_ENCRYPT=false SESSION_PATH=/ SESSION_DOMAIN=null BROADCAST_CONNECTION=reverb FILESYSTEM_DISK=local QUEUE_CONNECTION=database CACHE_STORE=database CACHE_PREFIX= MEMCACHED_HOST=127.0.0.1 REDIS_CLIENT=phpredis REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=log MAIL_HOST=127.0.0.1 MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false VITE_APP_NAME="${APP_NAME}" REVERB_APP_ID=835917 REVERB_APP_KEY=bkefoajmyavya3ph3lml REVERB_APP_SECRET=ebsrnbqajrgwfwnaorrz REVERB_HOST="laravel-reverb-ssl-issue.test" REVERB_PORT=8080 REVERB_SCHEME=https VITE_REVERB_APP_KEY="${REVERB_APP_KEY}" VITE_REVERB_HOST="${REVERB_HOST}" VITE_REVERB_PORT="${REVERB_PORT}" VITE_REVERB_SCHEME="${REVERB_SCHEME}"

This is how issue can be reproduced:

  1. Checkout repo
  2. set valet link
  3. set env file
  4. composer install
  5. php artisan migrate

run reverb & queue worker

execute from tinker: App\Events\TestEvent::dispatch();

Job will fail and you can find error from logs.

bretterer commented 4 months ago

I am also having ssl issues. I believe its the same.

https://github.com/bretterer/reverb-ssl-test is my reproduction repo. I am using Laravel Herd instead of straight Valet, but its a secure domain.

I'm using: Laravel 11.4.0 Laravel Installer 5.7.1 PHP 8.3.6 Herd 1.6.0 Reverb "laravel/reverb":"@dev"

Steps I took:

1: laravel new reverb-ssl (No starterkit, pest) 2: enable ssl in herd for new site 3: update APP_URL in .env to include https 4: start reverb service on port 8080 on Herd 5: php artisan install:broadcasting 6: Create a test event SiteVisited and update the PrivateChannel name to site-visited 7: Implement ShouldBroadcast in the new event 8: update routes/channel.php

Broadcast::channel('site-visit', function () {
    return true;
});

9: edit web.php route to include SiteVisited::broadcast() (also tried dispatch) 10: Add listener to echo.js (Docs say I can use Echo.private but says Echo is undefined, need to use window.Echo)

window.Echo.private('site-visit')
    .listen('SiteVisted', function(e) {
        console.log(e);
    });

10: started npm run dev 11: started php artisan queue:work

Errors in console: WebSocket connection to 'wss://localhost:8080/app/e0bgxgxlni4u4wntyj2k?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed: WebSocket is closed before the connection is established.

As a note, I did the same configuration and steps without securing the website and using https and it works fine.

joedixon commented 4 months ago

@bretterer I think you need to set REVERB_HOST and VITE_REVERB_HOST to reverb-ssl.test (or whatever your Herd secured site name is).

bretterer commented 4 months ago

@joedixon, I tried that, and It does not change anything for me

joedixon commented 4 months ago

@bretterer I have just tested your repo - you need to update your environment variables as follows:

REVERB_APP_ID=147395
REVERB_APP_KEY=e0bgxgxlni4u4wntyj2k
REVERB_APP_SECRET=vn7tuvmso5cmmlvz7uwg
- REVERB_HOST="localhost"
+ REVERB_HOST="reverb-ssl-test.test"
REVERB_PORT=8080
- REVERB_SCHEME=http

Using the correct hostname and removing the plaintext scheme which will use the https default instead should resolve your issue.

@jksa I'm a Herd user so going to take me a little longer to test on Valet.

joedixon commented 4 months ago

@jksa can you try updating the client_options settings of the reverb broadcaster in your broadcasting.php configuration file as follows?

You won't want to do this in production so I would recommend making it an environment variable if it solves the issue.

'client_options' => [
    'verify' => false,
],
jksa commented 4 months ago

@joedixon that really sounded promising, but unfortunately did not help.

joedixon commented 4 months ago

That did resolve the problem for me. Can you share:

jksa commented 4 months ago

Sure, here you go:

broadcasting.php env('BROADCAST_CONNECTION', 'null'), /* |-------------------------------------------------------------------------- | Broadcast Connections |-------------------------------------------------------------------------- | | Here you may define all of the broadcast connections that will be used | to broadcast events to other systems or over WebSockets. Samples of | each available type of connection are provided inside this array. | */ 'connections' => [ 'reverb' => [ 'driver' => 'reverb', 'key' => env('REVERB_APP_KEY'), 'secret' => env('REVERB_APP_SECRET'), 'app_id' => env('REVERB_APP_ID'), 'options' => [ 'host' => env('REVERB_HOST'), 'port' => env('REVERB_PORT', 443), 'scheme' => env('REVERB_SCHEME', 'https'), 'useTLS' => env('REVERB_SCHEME', 'https') === 'https', ], 'client_options' => [ 'verify' => false, // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html ], ], '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'), 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'port' => env('PUSHER_PORT', 443), 'scheme' => env('PUSHER_SCHEME', 'https'), 'encrypted' => true, 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', ], 'client_options' => [ // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html ], ], 'ably' => [ 'driver' => 'ably', 'key' => env('ABLY_KEY'), ], 'log' => [ 'driver' => 'log', ], 'null' => [ 'driver' => 'null', ], ], ];
composer.json { "name": "laravel/laravel", "type": "project", "description": "The skeleton application for the Laravel framework.", "keywords": ["laravel", "framework"], "license": "MIT", "require": { "php": "^8.2", "laravel/framework": "^11.0", "laravel/reverb": "@dev", "laravel/tinker": "^2.9", "livewire/livewire": "^3.4", "livewire/volt": "^1.0" }, "require-dev": { "fakerphp/faker": "^1.23", "laravel/breeze": "^2.0", "laravel/pint": "^1.13", "laravel/sail": "^1.26", "mockery/mockery": "^1.6", "nunomaduro/collision": "^8.0", "phpunit/phpunit": "^11.0.1", "spatie/laravel-ignition": "^2.4" }, "autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "scripts": { "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-update-cmd": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi", "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"", "@php artisan migrate --graceful --ansi" ] }, "extra": { "laravel": { "dont-discover": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, "allow-plugins": { "pestphp/pest-plugin": true, "php-http/discovery": true } }, "minimum-stability": "dev", "prefer-stable": false }
env APP_NAME=Laravel APP_ENV=local APP_KEY=base64:xphd5PuSjc3qy4M9uqJ0XZUSPvOSEHtNZtx3CcyD7+w= APP_DEBUG=true APP_TIMEZONE=UTC APP_URL=https://reverb-app.test APP_LOCALE=en APP_FALLBACK_LOCALE=en APP_FAKER_LOCALE=en_US APP_MAINTENANCE_DRIVER=file APP_MAINTENANCE_STORE=database BCRYPT_ROUNDS=12 LOG_CHANNEL=stack LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=sqlite # DB_HOST=127.0.0.1 # DB_PORT=3306 # DB_DATABASE=laravel # DB_USERNAME=root # DB_PASSWORD= SESSION_DRIVER=database SESSION_LIFETIME=120 SESSION_ENCRYPT=false SESSION_PATH=/ SESSION_DOMAIN=null BROADCAST_CONNECTION=reverb FILESYSTEM_DISK=local QUEUE_CONNECTION=database CACHE_STORE=database CACHE_PREFIX= MEMCACHED_HOST=127.0.0.1 REDIS_CLIENT=phpredis REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=log MAIL_HOST=127.0.0.1 MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false VITE_APP_NAME="${APP_NAME}" REVERB_APP_ID=835917 REVERB_APP_KEY=bkefoajmyavya3ph3lml REVERB_APP_SECRET=ebsrnbqajrgwfwnaorrz REVERB_HOST="reverb-app.test" REVERB_PORT=8080 REVERB_SCHEME=https VITE_REVERB_APP_KEY="${REVERB_APP_KEY}" VITE_REVERB_HOST="${REVERB_HOST}" VITE_REVERB_PORT="${REVERB_PORT}" VITE_REVERB_SCHEME="${REVERB_SCHEME}"
joedixon commented 4 months ago

That all looks good to me.

Can you verify in your composer.lock which version of Reverb is being installed?

bretterer commented 4 months ago

@joedixon Sadly, this is still an issue. Getting:

echo.js:6 WebSocket connection to 'wss://reverb-ssl.test:8080/app/e0bgxgxlni4u4wntyj2k?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed: WebSocket is closed before the connection is established.  (locally, i have reverb-ssl as the folder in Herd)

I tried somethings around going to https://reverb-ssl.test:8080 as I am using Brave browser and it sounds like chrome has a cert issue, but nothing resolves at that url (i suspected that to be the case)

Would you like me to open a new issue, or do you think this is related? Were you able to get my example repo up and running using Herd and Herd Reverb service?

joedixon commented 4 months ago

@bretterer this should be fixed on the main branch - can you give that a try?

bretterer commented 4 months ago

seems "laravel/reverb": "dev-main", is still giving the same error

Here is my Herd services Screenshot 2024-04-22 at 12 33 20 PM

joedixon commented 4 months ago

@bretterer the Reverb Herd service is separate and doesn't yet have TLS support.

Are you trying to use that or do you have Reverb installed in your application?

bretterer commented 4 months ago

reverb is installed in my application. Let me try php artisan reverb:start

bretterer commented 4 months ago

@joedixon Seems to be that. php artisan reverb:start I no longer see the error in brave.

There are few items I would suggest for docs,

  1. Make a note about Herd not being able to handle secure yet
  2. when setting up a listener, you have to use window.Echo. instead of just Echo
  3. Showing a simple channels.php route for this, as I personally am having issues using PrivateChannel to test with
    Broadcast::channel('site-visit', function () {
    return true;
    });

That gives a 403, but thats not for this ticket.

Thank you so much for the help!

jksa commented 4 months ago

That all looks good to me.

Can you verify in your composer.lock which version of Reverb is being installed?

Here you go!

composer.lock.zip

joedixon commented 4 months ago

Thanks @jksa - I went deeper into the rabbit hole today and think I came out with a solution.

Would you be able to give this PR a test: https://github.com/laravel/reverb/pull/167

vesper8 commented 4 months ago

@joedixon I am having the same problem. I forked reverb and applied your PR to my fork: https://github.com/vesper8/reverb

This made the problem go away for me. My broadcasting tests now work on localhost using Laravel Valet and SSL where previously they were failing with SSL_ERROR_SYSCALL

All of this is probably indeed related to openssl's new 3.3 release. A very similar thing happened when they released 3.2 back in November of last year.

Thanks for looking into it and providing a fix. Hope it gets merged soon.

jksa commented 4 months ago

Thanks @jksa - I went deeper into the rabbit hole today and think I came out with a solution.

Would you be able to give this PR a test: #167

@joedixon I'm more than happy to confirm that PR seem to fix my issue!!! Now dispatching events via work queue runs with out errors and browser receives events! Excellent!!! Thanks a lot for you efforts! Any ideas when this would be released?

joedixon commented 4 months ago

I want to do a little more testing, but assuming all goes well, I think it's likely we can get a new release out pretty soon.