微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Laravel Echo + Pusher 授权服务器错误 500

如何解决Laravel Echo + Pusher 授权服务器错误 500

我正在尝试使用 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 事件类。配置错误。

,

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。