-
Notifications
You must be signed in to change notification settings - Fork 658
Invalid auth signature provided Exception #34
Comments
FYI, I have no other issues with the package and other issues for which I had, I've sent PRs for it. Everything else and other parts of the app works fine. Just this part I'm having trouble and there are no logs for some reason. So it's quite challenging to debug the issue. |
Inside WebSockets/Channels/Channel.php, you have verifySignature method. It is trying to compare hash_hmac of the payload and app's secret. This will fail because $payload->auth take the value inside config/broadcasting.php. But the hash_hmac('sha256', $signature, $connection->app->secret) returns the value for the app you are currently selecting. |
I can confirm we're seeing the same behaviour: for some of our events, we're getting this invalid auth signature;
|
I think this might be caused by the signatures not being validated correctly according to what the Pusher server does, might be fixed with #38. |
@stayallive I tested your code and unfortunately, It's throwing that exception for every event now instead of specific ones so that has not resolved the issue rather introduced a new one. |
@irazasyed checkout my PR #39 |
@coolcodemy That didn't resolve the issue either plus it's not specific to dashboard related events or auth. |
@irazasyed oopss. sorry. That fix was for invalid signature. I've read it wrong. |
I am seeing that too... this has to do with the route params being added as query parameter causing the validation to fail... damn. Back to the drawing board... |
So I've been debugging this issue all day today and here are a few things I found that may help us get to the root:
|
Would you be able to provide the payload that got dropped? There are various |
Experiencing this same issue and can confirm changing the data being broadcast fixes the issue. |
@harrynewsome do you happen to have an example of a payload in the broadcast that reliably causes the issue? |
I have the web socket server talking to three deployments of my code (one server with three socket apps defined). For my local and staging servers, it is working well. For my production server, I am getting the On the actual socket server, there is an error in the log for each request: |
I can confirm this Exception is thrown when the payload you're trying to broadcast is too large. Somewhere along the way, the body of the It's not the |
Not sure if this is related, but I just merged a PR that fixes the way we generate and validate the auth signatures. |
I'll give it a try later today, here's what I saw when debugging this issue;
For instance, here's a part of the payload that failed. Note how the
I will track it down further to see if the data in the event got truncated at the source or at the destination, to narrow it down. |
^ that looks like the output of a |
Hmm good point, this was caught by a |
The payload I am sending is not anywhere near 65K. I have two more or less identical servers sending data to the websocket server - same Laravel code base (one staging, one production) - and one works fine and the other generates the |
@mattiasgeniar also looking at your @ulfie22 Would be great if you can validate if that's still the case with the code in master ( |
@stayallive I loaded 1.0.4 (I had been using |
UPDATE: @mpociot was extraordinarily generous with his time and helped me discover that the issue I was having was totally pilot error by me. Thank you all for your suggestions and for me this is confirmation again that checking your configuration data for the hundredth time is probably worthwhile. This is an incredibly important project and again thank the authors and community for making it possible. |
@ulfie22 would you be able to share what was wrong in you config since you are not the only one that might have done this and other can benefit from knowing where to double-check? Related: https://xkcd.com/979/ |
@ulfie22 Running also into the same issue, could you share what was wrong with your config ? |
@stayallive @yizen it's almost too embarrassing to admit: i am running 3 socket apps on one server (the server is at digital ocean; i have my local machine, plus staging and production servers at AWS). my configuration error was having the wrong app key in the |
Thanks @ulfie22 , that was helpful : I'm going to double check all my AWS Beanstalk vars ! |
@stayallive @yizen @mpociot I'm baaaack... :) I have my socket server working correctly and am using it to great effect .... until I started adding more events. My app now sends one HTTP request that triggers a bunch of events which cause different pieces of data to be broadcast through the socket server. As I expanded one of these data payloads, it started failing with the failing: The failing one has an additional data item ( does Laravel somehow limit the size of the packet that can be sent? |
Laravel certainly does not but it could be in the Pusher SDK or even in the Ratchet HTTP server implementation. (have not had the time to dig in but awesome you are able to provide some payloads!) |
Alright. So I did a lot of digging and here's what I found out: The way I could reproduce this issue:
The error occurs and the payload gets truncated (at some point) It works though, if I broadcast the same event on the Forge server to the local websocket server (127.0.0.1 as the Pusher host). This must be some kind of network configuration as it works locally, but not from a remote connection. @mattiasgeniar do you have any idea? |
That is class A sherlock work! Mattias as a server guru hopefully has something smart to add that could point to a reason 👍 After a bit of Googling I found these very old issues: They do seem to point to something similar, but as far as I can tell this has long been fixed, although I know Ratchet is a bit older so something about it could somehow affect it still if it's not something in the networking unrelated to the PHP code :) Just wanted to drop it here in case it rings a bell for anyone. |
@stayallive @yizen @mpociot as an experiment, I made a Laravel event where I could control the size of the payload that was sent to the |
Alright. I finally figured out what was causing the issue. |
In case it helps anyone I had the same error because I was running my event through a queue (Redis/Horizon) and hadn't restarted the queue worker (php artisan horizon:terminate) since I added the needed environment variables so things like the PUSHER_APP_ID hadn't updated on the queue. |
Remember enable this line |
This issue is happening again. I am on version 1.4. For long payload, It fails with the exception "Invalid auth signature provided Exception". |
Thanks! this really help me. |
So I have a search engine built into my app that fetches results from multiple sources from across the web from different engines and broadcasts the results in real-time as we get a response.
I was using
laravel-echo-server
earlier and it was all good. I migrated to this package and have been facing this issue. At first, I thought it could be a third-party issue and tested the APIs and everything else but it seems like everything is fine at that end but when it's broadcasting results in a loop, it shows this error for few broadcasts.What you think could be breaking the flow and causing this issue? I'm sending JSON payload of results after we've parsed and transformed as per the format we need on the front-end.
The text was updated successfully, but these errors were encountered: