Were you able to resolve it? I had an issue several months back with mine. I can't remember what the issue was, but I was getting frustrated with not seeing anything in the logs. The way I eventually figured it out was by putting dd()'s in my code to figure out how far the process was getting, and finally narrowed it down to exact location that was holding it up.
Some events aren't broadcasting using Vapor + Pusher
My application is using Vapor with AWS, and it uses Pusher for real-time functionality.
Locally, my application is working as expected. I have several events and all of them broadcast as expected through Pusher. In addition to the application working, I can also confirm that all events are broadcasting by using the Pusher Debug Console.
I currently have one vapor environment, production. Some events are broadcasting on production, but others are not. I cannot figure out why some events are not broadcasting, and I've ripped out what's left of my hair.
I have one event in particular which is broadcasting in some contexts but not others. Specifically, this event has a "status" property which is a string of either "open", "close", or "delete". The event is dispatched in three controller methods, the resource's store(), update(), and delete() methods respectively. The event dispatches are identical aside from the status argument. The event broadcasts on a PresenceChannel.
Here's what I've tried or learned so far:
- I confirmed my pusher credentials on production using vapor tinker, and ruled this out (since some events are working, that's a nail in this coffin).
- I confirmed that the Pusher app is configured correctly by using the production API creds locally, and verified that all events work as expected and show in the Pusher Debug Console as expected.
- On production, the events which aren't working are not showing in the Pusher Debug Console. The Pusher Error Logs are all empty.
- I added several
Log::debug()calls in the application in a few spots: the controller methods of events which are and are not working, the__construct()method of the event, and thebroadcastOn()method of the event. Locally, all the log entries write as expected. On production, theLog::debug()call in thebroadcastOn()method never fires, even on the event broadcasts which are working. The other log entries do work. - Aside from (some of) my debugging calls, there's nothing in my vapor logs.
Thanks in advance for any suggestions and assistance!
Got to the bottom of this. It turns out that Vapor sets the env var QUEUE_CONNECTION to sqs by default. My events preceded deleting objects, so when the queue job ran, the objects were no longer available. I haven't figured out why this error wasn't logging anywhere, but that's a question for another day.
In my case, the simplest solution was to update my events to implement ShouldBroadcastNow instead of ShouldBroadcast to force them to use the synchronous queue.
Please or to participate in this conversation.