ably-forks / laravel-echo

Laravel Echo library for beautiful Pusher and Ably integration.
https://laravel.com/docs/broadcasting#client-side-installation
MIT License
12 stars 4 forks source link

customInternalAttach -> authorize -> errCallback undefined? #29

Closed ryzr closed 8 months ago

ryzr commented 8 months ago

Echo Version

1.0.3

Laravel Version

10.38.1

PHP Version

8.2

NPM Version

10.1

Database Driver & Version

MySQL 8.0.35 on AWS RDS

Description

Just a minor one, but gets a bit spammy in Sentry. There appears to be cases where the overriden channel attach method is called with an undefined errCallback. It doesn't appear to have any impact on the end user, but it does get reported in Sentry at least a few times a day

2023-12-22_103721_TypeError i is not a function — lumin-sports-technology — arc-core-field@2x

https://github.com/ably-forks/laravel-echo/blob/master/src/channel/ably/attach.ts#L28

Wasn't sure if it would be fine to check if errCallback is defined before calling, or something more elaborate like this would be necessary:

https://github.com/ably/ably-js/blob/fdd5a566eafac0a7fae9592f890361a608794487/src/common/lib/client/realtimechannel.ts#L335-L339

Merry Christmas! 🎄

Steps To Reproduce

I haven't been able to reproduce this myself, but looking at the Sentry replays, it seems that users are idling, a request is made which 403s, and then the error above occurs.

sync-by-unito[bot] commented 8 months ago

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-4008

sacOO7 commented 8 months ago

@ryzr Thanks for reporting, seems we can modify check as

if (error && errCallback)
sacOO7 commented 8 months ago

Since this is a small change, you might like to create a PR for the same 👍

sacOO7 commented 8 months ago

@ryzr I have merged the PR. We will see if we can do the release in the near future. If you want to use the latest code on the master branch, you can include github url for the same in package.json dependency. https://dev.to/michalbryxi/github-urls-in-package-json-5412

sacOO7 commented 8 months ago

Seems we need to fix this properly, so I opened https://github.com/ably-forks/laravel-echo/pull/31

sacOO7 commented 8 months ago

@ryzr please do add comments there if you find anything missing

ryzr commented 8 months ago

Thanks @sacOO7 😄

sacOO7 commented 8 months ago

@ryzr I have merged the PR. We will see if we can do the release in the near future. If you want to use the latest code on the master branch, you can include github url for the same in package.json dependency. https://dev.to/michalbryxi/github-urls-in-package-json-5412

@ryzr do update the code as per comment and let us know if you still facing issues with sentry.

sacOO7 commented 8 months ago

@ryzr please do star https://github.com/ably/laravel-broadcaster and this repo if your issue is addressed 👍

ryzr commented 8 months ago

Have done - thanks again for all your help, I appreciate it! :-)