stayallive / wp-sentry

A (unofficial) WordPress plugin reporting PHP and JavaScript errors to Sentry.
https://wordpress.org/plugins/wp-sentry-integration/
MIT License
300 stars 48 forks source link

WP Rocket delay JS and Sentry integration compatibility. #200

Closed zimdin12 closed 1 month ago

zimdin12 commented 1 month ago

I am not sure which of these plugins is causing this.

Problem: On Android and IOS links do not work. I press on the link, it gets focused, JS loads and nothing happens even when I click on it again, it won't work. basically you cannot use that button anymore (other links / buttons work). I spent too much time to figure out what is going on.

It happens when i have latest WP sentry integration and WP Rocket installed with WP Rocket having delay JS turned on.

I did add wp-sentry-browser to defer JS exclusion list. that helped and it works again. It seems that it doesn't happen out of the box. something triggers it and I am not sure what it is.

On another site I build and manage it does not happen, but that site is much newer and everything is basicly on latest version. Site that it does happen does have some deprecation warnings etc.

I did report this under WP Rocket repo also: https://github.com/wp-media/wp-rocket/issues/6792

stayallive commented 1 month ago

Have you debugged this yourself at all already? Have you for example checked if there are errors showing up in Sentry? Or in the browser console of the device where this happens?

Regardless I would advise you to not delay loading the Sentry scripts since that kind of defeats the purpose. Sentry can only capture errors when it's loaded so if it loads pretty late errors could already have been occurred you will never see.

If it's something I can do from the plugin perspective I will revisit this but I don't think there is much of anything for me to fix here. As WP Rocket also mentions "Depending on your site, you may also need to exclude some more files from being deferred" (see: https://docs.wp-rocket.me/article/1265-load-javascript-deferred).

Again, happy to revisit if there is something I am doing "wrong" in this plugin but otherwise there isn't much for me to do here unfortunately so I am closing the issue for now. Let me know if something comes up I can investigate!

zimdin12 commented 1 month ago

this problem tried to broke my sanity :D but I guess I do agree with your points.

If there is something to improve then it is awesome. if not then I hope that this post helps somebody who is having same problem. :) when I was investigating it then I didn't find anybody mentioning this.

stayallive commented 1 month ago

I can totally understand, and also thank you for understanding my position.

And indeed, thanks for submitting the issue anyway in case someone else runs into this in the future!