filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.25k stars 2.96k forks source link

Laravel Echo not working #8135

Closed francoism90 closed 1 year ago

francoism90 commented 1 year ago

Package

filament/filament

Package Version

v3.0.34

Laravel Version

v10.20.0

Livewire Version

v3.0.1

PHP Version

8.20

Problem description

Filament always connects to the wrong Pusher-host, and not to the values defined in the config/filament.php:

'broadcasting' => [

        'echo' => [
            'broadcaster' => 'pusher',
            'key' => env('VITE_PUSHER_APP_KEY'),
            'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
            'wsHost' => env('VITE_PUSHER_HOST'),
            'wssPort' => env('VITE_PUSHER_PORT'),
            'disableStats' => true,
            'encrypted' => true,
        ],

    ],

As you can see, I'm overruling the host + post, as I'm running my own Soketi instance. For some reason, it keeps using the default values, and don't use the given values at all.

I'm trying to find out the reason why, because this wasn't an issue on V2.

Expected behavior

Use given (echo/Pusher) broadcasting config.

Steps to reproduce

  1. Install + configure Laravel Echo
  2. Uncomment and adjust in config/filament.php
  3. Open page that uses channels
  4. Page uses wrong host

Reproduction repository

https://github.com/francoism90/hub-api/tree/feat-livewire

Relevant log output

-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sockjs-mt1.pusher.com/pusher/app/app-key/... (Reason: CORS request did not succeed). Status code: (null).
francoism90 commented 1 year ago

Fixed by https://github.com/filamentphp/filament/pull/8137

Turns out Pusher will fallback to their own servers when the configuration is invalid. Make sure to define the host without any protocol and also check the auth path.