intercom / intercom-rails

The easiest way to install Intercom in a Rails app.
https://developers.intercom.io/reference
MIT License
281 stars 108 forks source link

Intercom, Sentry, and Turbolinks don't play nicely together #324

Open jhubert opened 4 years ago

jhubert commented 4 years ago

Version info

Expected behavior

A vanilla installation of Rails 5 with Turbolinks, Sentry, and Intercom should not produce errors in IE.

Actual behavior

We're seeing millions of JS errors get reported in Sentry when Turbolinks, Intercom, and Sentry are used together.

With any two there is no issue, but when all 3 are used at the same time in a default installation IE11 kicks off a "Can't execute code from a freed script" error on every mousemove event after the first Turbolinks page load.

I've spent well over 40 hours on this issue over the last 2 years with no success. I've torn apart Sentry and tried my best to tear apart and trace the Intercom widget code. We've mostly resorted to configuring Sentry to not report the error, but it's spotty and memory quickly becomes an issue which causes browser crashes.

The best I can tell so far is that Intercom doesn't seem to removeEventListeners in IE11 properly so Sentry still tries to run the wrapped listener on an object that's been destroyed. But, I could be wrong and just unable to trace it properly.

Steps to reproduce

I've built a vanilla rails app to isolate the issue. You can check it out here: https://github.com/jhubert/sentry-intercom-turbolinks-issue

  1. Download that repo
  2. Get a sentry DSN
  3. Follow the instructions in the README

Help?

I would be more than happy to hop on Zoom to take someone through this if it would be helpful.

jhubert commented 4 years ago

I had a conversation with support confirming this issue 10 weeks again. Any way I can help move this forward?

Artboard

jhubert commented 4 years ago

Checking in here again. @sduquej Any insight into this or ways that I can help clarify?

sduquej commented 4 years ago

Hey @jhubert, really appreciate the detail you've provided here and the repo with repro steps. I won't have the bandwidth to look into this soon but I'm raising it with the team.

We had seen this error in our own setup (we also use Sentry) about a year ago but we made changes to it and there hasn't been an instance of it in 90+ days. Do you have many users still using IE11?

I know this isn't great but if you haven't already I'd suggest configuring Sentry to ignore this error so that it doesn't eat up your quota :-/ As far as I can tell, there's no detrimental UX other than the annoying error in the IE console. Does this match what you're seeing?

jhubert commented 3 years ago

@sduquej Thanks for the follow up. Somehow I missed the notification.

We ignored it in Sentry a while ago. It still comes up as an issue when doing anything in browserstack due to memory overloads. Those listeners stack on top of each other without getting cleared because of Turbolinks. A few pages in and the site can get really slow on older computers. Disabling Intercom fixes it.

The majority of our desktop users are on IE11 because we sell an enterprise product to retailers who are generally not on the latest technologies.

We had seen this error in our own setup (we also use Sentry) about a year ago but we made changes to it and there hasn't been an instance of it in 90+ days

What changes did you make?

jhubert commented 3 years ago

@sduquej Any follow up on this? I'd love to get some resolution. I have full control over sentry and turbolinks, but the intercom listeners seem to be the problem and I'm limited to what I can change there.