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

Subscription with echo AuthError pusher:subscription_error #2622

Closed
Stevemoretz opened this issue Oct 14, 2024 · 6 comments
Closed

Subscription with echo AuthError pusher:subscription_error #2622

Stevemoretz opened this issue Oct 14, 2024 · 6 comments
Labels
bug An error within Lighthouse

Comments

@Stevemoretz
Copy link
Contributor

Describe the bug

{
  "channel": "private-lighthouse-xmLISs3gzebsE8QtN6B0y10zYuNjzrUJ-1728925422",
  "data": {
    "type": "AuthError",
    "error": "The connection is unauthorized.",
    "status": 401
  },
  "error": "The connection is unauthorized.",
  "status": 401,
  "type": "AuthError",
  "event": "pusher:subscription_error"
}

Expected behavior/Solution

Steps to reproduce

  1. Following the official guide, will just give us this error. Notice that the current js library doesn't even work without with my pull request so apply that first: Update subscription-link.ts thekonz/apollo-lighthouse-subscription-link#28
  2. Send a subscription request, watch your browser's network tab, under websocket connections you'll see the provided error.

Output/Logs

Click to expand
# Add in log output/error messages here

Lighthouse Version

6.45

@Stevemoretz
Copy link
Contributor Author

I don't know why you did EchoBroadcaster return that result for auth request, but changing the signature to your PusherBroadcaster fixes that:

#2623

I didn't write any tests or change anything else since I have no idea about your intentions of returning the result like the way you are right now.

@spawnia
Copy link
Collaborator

spawnia commented Oct 15, 2024

Conjuring @thekonz 😉

@spawnia spawnia added the bug An error within Lighthouse label Oct 15, 2024
@thekonz
Copy link
Collaborator

thekonz commented Oct 15, 2024

I made that package and the echo broadcaster, because I was using laravel-echo-server instead of pusher. This is usually either done for privacy or cost reasons.

So that getPusher call just seems wrong.

You can use the echo client, but connect to pusher using the echo subscription broadcaster.

@Stevemoretz
Copy link
Contributor Author

Stevemoretz commented Oct 15, 2024

I made that package and the echo broadcaster, because I was using laravel-echo-server instead of pusher. This is usually either done for privacy or cost reasons.

So that getPusher call just seems wrong.

You can use the echo client, but connect to pusher using the echo subscription broadcaster.

Thanks for the reply, I'm not using pusher, as a matter of fact my server is supposed to run locally without any internet, I'm using a pusher compatible server that laravel suggests:"soketi".

Also laravel echo server, doesn't seem to be maintained anymore.

In any case, I'd say it makes sense to support pusher as well, you might want to support both, by specifying an option and a simple if statement between my code and yours.

Or maybe it is already supported I didn't understand your last sentence:
"You can use the echo client, but connect to pusher using the echo subscription broadcaster."

@thekonz
Copy link
Collaborator

thekonz commented Oct 15, 2024

If you are using pusher, use the pusher broadcaster, not the echo broadcaster.
The client can still be echo (https://github.com/laravel/echo), but the backend has to be pusher. For that, just leave the LIGHTHOUSE_BROADCASTER env empty, because the default is pusher.

The echo broadcaster was there to be used with echo server.
You make a good point about echo server no longer being maintained and we should probably remove the echo broadcaster.

@Stevemoretz
Copy link
Contributor Author

If you are using pusher, use the pusher broadcaster, not the echo broadcaster. The client can still be echo (https://github.com/laravel/echo), but the backend has to be pusher. For that, just leave the LIGHTHOUSE_BROADCASTER env empty, because the default is pusher.

The echo broadcaster was there to be used with echo server. You make a good point about echo server no longer being maintained and we should probably remove the echo broadcaster.

Makes sense, I can't test it right now but I'm sure doing what you suggested should just fix it. I thought echo was only supposed to work with echo broadcaster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error within Lighthouse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants