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

Laravel Reverb Message pusher.error #136

Closed xerk closed 4 months ago

xerk commented 4 months ago

Reverb Version

@beta

Laravel Version

10.47

PHP Version

8.2

Description

I have installed Larave Reverb on Laravel 10 and after installing everything I websocket fetch pusher error message

{"event":"pusher:error","data":"{\"code\":4001,\"message\":\"Application does not exist\"}"}

Steps To Reproduce

My Event:

 public function broadcastOn()
    {
            return new PresenceChannel('reverb');
   }
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Pusher = Pusher;

window.Echo = new Echo({
  broadcaster: 'reverb',
  key: import.meta.env.VITE_REVERB_APP_KEY,
  wsHost: import.meta.env.VITE_REVERB_HOST,
  wsPort: import.meta.env.VITE_REVERB_PORT ?? 80,
  wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
  forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
  enabledTransports: ['ws', 'wss'],
});

// PresenceChannel('reverb')

window.Echo.join('reverb')
  .here((users) => {
    console.log('here', users);
  })
  .joining((user) => {
    console.log('joining', user);
  })
  .leaving((user) => {
    console.log('leaving', user);
  });
driesvints commented 4 months ago

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!

sprtk-ches commented 4 months ago

FWIW, I'm having the same exact issue. This is using a fresh Laravel 10 project + Herd on windows 11. Everything is boilerplate using the code from the documentation pretty much.

Also when I dispatch an event, I get the following error

Pusher error: No matching application for ID [...]

@xerk Check that you config/reverb.php has the correct setup for the apps. Something like

    'apps' => [

        'provider' => 'config',

        'apps' => [
            [
                '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',
                ],
                'allowed_origins' => ['*'],
                'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
                'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
            ],
        ],

    ],
mousa4007 commented 4 months ago

@xerk i have the same problem .. can you fix this ?

dembal1990 commented 4 months ago

+1

Karu272 commented 3 months ago

same issue. I use laravel sanctum api setup with vue 3 as frontend. stuck with

{event: "pusher:error", data: "{"code":4001,"message":"Application does not exist"}"} data : "{\"code\":4001,\"message\":\"Application does not exist\"}" event : "pusher:error"

joedixon commented 3 months ago

What does the request to connect to the WebSocket server look like in your network tab?

xerk commented 3 months ago

@mousa4007 yes I solved it, I was using wrong secret make sure u are using the secret of reverb

yosha10 commented 2 months ago

@mousa4007 how you solve this?

paulocastellano commented 2 months ago

@mousa4007 yes I solved it, I was using wrong secret make sure u are using the secret of reverb

can explain better how you fixed it?

sepgg commented 2 months ago

Hello everyone, the problem went away when I deleted the config/reverb.php file.

joserojasrodriguez commented 1 month ago

Same error here, any solution?

phpmac commented 1 month ago

找到问题了,修改 .env 参数需要重新运行 php artisan reverb:start

nasiriyima commented 1 month ago

same issue. I use laravel sanctum api setup with vue 3 as frontend. stuck with

{event: "pusher:error", data: "{"code":4001,"message":"Application does not exist"}"} data : "{\"code\":4001,\"message\":\"Application does not exist\"}" event : "pusher:error"

In my case I was using the wrong REVERB_APP_KEY in laravel-echo font end

dembal1990 commented 1 month ago

I had the same error. The problem was in the config/reverb.php file. The app definitions need to be under the apps key, which should be under another apps key. Correct:

   'apps' => [

        'provider' => 'config',

        'apps' => [
            [
                'key' => env('REVERB_APP_KEY'),
                 ...
            ],
        ],

    ],

My wrong config:

   'apps' => [
        'provider' => 'config',
         'key' => env('REVERB_APP_KEY'),
         ...
    ],