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

Uncaught TypeError: Cannot read property 'appId' of null #295

Open summera opened 6 years ago

summera commented 6 years ago

Version info

Expected behavior

No error.

Actual behavior

Receiving Uncaught TypeError: Cannot read property 'appId' of null in console in one of our testing environments and then the Messenger does not show. What's interesting, is this is not happening in our production environment. The testing environment and production environment are using separate Intercom apps. I'm using Turbolinks and it seems to happen on a Turbolinks page load (rather than a full page load) and when using the back button. This is happening in Chrome 67.0.3396.99. I've tried clearing cache and cookies for the domain and that doesn't fix. I don't see the error in Chrome Incognito mode or in Firefox.

Logs

VM206 frame.33e73fb5.js:1 Uncaught TypeError: Cannot read property 'appId' of null
    at c.t.mapStateToProps [as finalMapStateToProps] (VM206 frame.33e73fb5.js:1)
    at c.computeStateProps (VM206 frame.33e73fb5.js:1)
    at c.updateStatePropsIfNeeded (VM206 frame.33e73fb5.js:1)
    at s (VM206 frame.33e73fb5.js:1)
    at c.handleChange (VM206 frame.33e73fb5.js:1)
    at l (VM206 frame.33e73fb5.js:1)
    at VM206 frame.33e73fb5.js:1
    at VM206 frame.33e73fb5.js:1
    at VM206 frame.33e73fb5.js:1
    at VM206 frame.33e73fb5.js:1
    at VM206 frame.33e73fb5.js:1
    at VM206 frame.33e73fb5.js:1
    at VM206 frame.33e73fb5.js:1
    at VM206 frame.33e73fb5.js:1
    at Object.dispatch (VM206 frame.33e73fb5.js:1)
    at e.destroy (VM206 frame.33e73fb5.js:1)
    at e.destroySession (VM206 frame.33e73fb5.js:1)
    at Object.shutdown (VM206 frame.33e73fb5.js:1)
    at VM206 frame.33e73fb5.js:1
    at HTMLDocument.y (shim.86cccbeb.js:1)
    at HTMLDocument.e.bugsnag (application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11)
    at Object.e.dispatch (application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:10)
    at n.notifyApplicationAfterVisitingLocation (application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11)
    at n.startVisit (application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11)
    at n.historyPoppedToLocationWithRestorationIdentifier (application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11)
    at n.onPopState (application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:10)
    at application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:10
t.mapStateToProps @ VM206 frame.33e73fb5.js:1
c.computeStateProps @ VM206 frame.33e73fb5.js:1
c.updateStatePropsIfNeeded @ VM206 frame.33e73fb5.js:1
s @ VM206 frame.33e73fb5.js:1
c.handleChange @ VM206 frame.33e73fb5.js:1
l @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
e.destroy @ VM206 frame.33e73fb5.js:1
e.destroySession @ VM206 frame.33e73fb5.js:1
shutdown @ VM206 frame.33e73fb5.js:1
(anonymous) @ VM206 frame.33e73fb5.js:1
y @ shim.86cccbeb.js:1
e.bugsnag @ application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11
e.dispatch @ application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:10
n.notifyApplicationAfterVisitingLocation @ application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11
n.startVisit @ application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11
n.historyPoppedToLocationWithRestorationIdentifier @ application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11
n.onPopState @ application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:10
(anonymous) @ application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:10
application-d59dced96c29ca862c6a80fba0b2af5d765061252cc66fb0851760e10d3d13f9.js:11 
jpdelorenzo commented 5 years ago

I have the same issue.

In my case the issue persist for both environment.

Any ideas?

summera commented 5 years ago

@SeanHealy33 any idea what's going on here?

adnan-kamili commented 5 years ago

This happens when I call (window as any).Intercom('shutdown'); in my angular app

andychongyz commented 5 years ago

Try remove the intercom cookies https://github.com/mike-north/ember-intercom-io/issues/149

jpdelorenzo commented 5 years ago

Any update?

MatthewHerbst commented 5 years ago

I just experienced this as well. Our Intercom is installed via Segment 1.1

Uncaught (in promise) TypeError: Cannot read property 'appId' of null
    at frame.919fe903.js:25
    at frame.919fe903.js:25
    at frame.919fe903.js:25
    at frame.919fe903.js:25
    at frame.919fe903.js:25
    at frame.919fe903.js:11
    at frame.919fe903.js:25
    at dispatch (frame.919fe903.js:25)
    at Object.<anonymous> (frame.919fe903.js:11)
    at o (frame.919fe903.js:25)
    at Generator._invoke (frame.919fe903.js:25)
    at Generator.e.(anonymous function) [as next] (https://js.intercomcdn.com/frame.919fe903.js:25:84907)
    at o (frame.919fe903.js:11)
    at frame.919fe903.js:11
foureight84 commented 5 years ago

I have been seeing this as well. What I think is happening is that the shutdown call runs while Intercom process is loading (not 100% certain). My current work around is to add a delay to the shutdown:

setTimeout( () => {window.Intercom('shutdown')}, 600)