Closed wmt-web-pruthvip closed 5 months ago
@wmt-web-pruthvip to confirm, is this an issue only with debug mode enabled?
No, if debug mode is enabled, I get an error at Loggers/CliLogger.php:57. And without it gives at Pusher/EventHandler.php:56.
Even though it is working normally (with events), I am able to subscribe to the channel and receive updates. I am only having problems with graphql subscription.
The payload looks incorrect to me. When subscribing to a private channel, the payload should look more like below. Notice the requirement to pass through an auth token.
{
"event":"pusher:subscribe",
"data":{
"auth":"super-secret-token",
"channel":"private-channel"
}
}
This payload is set from the lighthouse package here. I think that needs to be updated for support.
Thanks for the update.
OK, closing this for now.
Reverb Version
1.0.0-beta4
Laravel Version
10.48.4
PHP Version
8.2.17
Description
I am using the Laravel Reverb package with GraphQL subscriptions implemented using the Lighthouse package (v6.35.0). When a subscription request is received by Reverb, it throws the following error:
The error is caused by the payload data being an array instead of a string, which is expected by the
subscribe
method in theEventHandler
class.The payload that triggers the error looks like this:
When running in
--debug
mode, an additional error is thrown:This error occurs because the
channel_data
value in the payload is also being treated as an array instead of a string.A possible fix for
--debug
might be to add a condition check for thechannel_data
value, similar to the existing check for thedata
value, before attempting to decode it usingjson_decode
. The condition could be something like&& is_string($message['data']['channel_data'])
.Additional Information:
If you need any further details about the Lighthouse implementation or any other relevant information, I will provide them to help better understand and resolve the issue.
Steps To Reproduce
start a reverb server running via
reverb:start
orreverb:start --debug
. Use the lighthouse package with theLIGHTHOUSE_BROADCASTER=echo
driver.