Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: JSON returned from channel-authorization endpoint was invalid, yet status code was 200. Data was: #1808

Open
anuradhan opened this issue Feb 24, 2024 · 0 comments
Labels
react Related to the react adapter

Comments

@anuradhan
Copy link

Version:

  • @inertiajs/react version: 1.0.0

Describe the problem:

this error is produced when using private channel with pusher.
public channel works fine without any error.

using
Laravel Echo + Pusher
on
Laravel + React.js + Inertia.js

image

code on bootstrap.js
window.Pusher = Pusher;
window.Echo = new Echo({
broadcaster: 'pusher',
key: import.meta.env.VITE_PUSHER_APP_KEY,
cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'ap2',
wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com,
wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
forceTLS: true,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws', 'wss'],
});

code on react.jsx file
window.Pusher.logToConsole = true;
window.Echo.logToConsole = true;
window.Echo.private('App.Models.User.'+user.id).listen('.notifications', (e) => {
console.log(e);
alert('hi');
});

code on notification event
image

i googled and found many are having similar issues. so, i tried changing auth endpoint, still no luck.
does inertia have this issue unresolved? or do we have a solution for this?

@anuradhan anuradhan added the react Related to the react adapter label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react Related to the react adapter
Projects
None yet
Development

No branches or pull requests

1 participant