【问题标题】:Laravel Echo + Pusher Authorization Server Error 500Laravel Echo + Pusher 授权服务器错误 500
【发布时间】:2021-08-05 19:18:13
【问题描述】:

我正在尝试使用 echo 测试和学习 laravel 的广播。但是在尝试和尝试之后,我无法实现我想要的。 它适用于公共频道。 但是当涉及到存在渠道时,它不会。 为了解决我所做的错误:

将 php 内存限制增加到 1 GB

我正在使用 Jetstream 和 Fortify。还有 InertiaJS。

浏览器调试授权标头

authorization headers

有错误

error: "Unable to retrieve auth string from auth endpoint - received status: 500 from /broadcasting/auth. Clients must be authenticated to join private or presence channels. See: https://pusher.com/docs/authenticating_users"
status: 500

App.js

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    forceTLS: true,
    
});

window.Echo.join(`chat.1`)
.here((users) => {
    console.log(users);
})
.joining((user) => {
    console.log(user.name);
})
.leaving((user) => {
    console.log(user.name);
})
.error((error) => {
    console.error(error);
});

BroadcastServiceProvider.php

public function boot()
{
   Broadcast::routes();

   require base_path('routes/channels.php');
}

channels.php

Broadcast::channel('chat.{ida}', function ($user, $ida) {
    if (auth()->check()) {
        return $user->toArray();
    }
});

site.net.error.log

[Sun May 16 10:24:49.754522 2021] [fcgid:warn] [pid 14900] [client ip:38966] mod_fcgid: stderr: PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:26:31.944725 2021] [fcgid:warn] [pid 4715] [client ip:39000] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 861929472) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:26:31.954042 2021] [fcgid:warn] [pid 4715] [client ip:39000] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 861929472) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:27:12.115963 2021] [fcgid:warn] [pid 19725] [client ip:39026] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 394264576) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:27:12.120752 2021] [fcgid:warn] [pid 19725] [client ip:39026] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 394264576) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:19.624249 2021] [fcgid:warn] [pid 14898] [client ip:39066] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 710934528) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:19.636461 2021] [fcgid:warn] [pid 14898] [client ip:39066] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 710934528) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:38.961347 2021] [fcgid:warn] [pid 14898] [client ip:39086] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 551550976) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:38.963699 2021] [fcgid:warn] [pid 14898] [client ip:39086] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 551550976) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:31:03.040755 2021] [fcgid:warn] [pid 14897] [client ip:39104] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 276824064) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:31:03.049553 2021] [fcgid:warn] [pid 14897] [client ip:39104] mod_fcgid: stderr: PHP Fatal error:  Out of memory (allocated 276824064) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard

【问题讨论】:

    标签: laravel-echo inertiajs jetstream pusher-js


    【解决方案1】:

    对于那些有这个问题的人,请查看 laravel 事件类。配置错误。

    【讨论】:

    • 您能否分享更多有关错误配置的信息?
    • 我检查了事件类,发现其中一些丢失了,其中一些有错误的类名。
    【解决方案2】:

    我遇到了类似的问题,我通过创建身份验证路由和控制器解决了这个问题。看看我在这篇文章中的解决方案:What can I do to resolve this pusher error-JSON returned from auth endpoint was invalid, yet status code was 200?

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 2020-05-14
      • 2018-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-02
      • 2020-11-15
      • 1970-01-01
      相关资源
      最近更新 更多