Http_post_session_empty error

We are using intercom in a React SPA. Calling shutdown followed by boot is causing an error. Here’s the relevant code:

if (!user) {
    aWindow.Intercom('shutdown');
    aWindow.Intercom('boot', {
      app_id: 'our-app-id'
    });
  }

The above code causes the following error in the developer console:

http_post_session_empty

Any idea why this is causing an error? Intercom loads and seems to work in spite of the error.

Thank you,

Troy

1 Like

Hey there Troy! :wave: Andy here from Intercom.

If the Intercom Messenger looks to be working fine, then I’m not sure what that error is (as I’ve also never seen that particular one before). :thinking: Besides the code you posted here, are you using our specific installation method for SPAs? And are there any other details in the error, or the network request (in the Network tab of the browser developer console?

And also, make sure you’re not using the window.intercomSettings object too, as that is used for non-SPA sites and can interfere with you SPA code!

Hey @leviathan898 we’re also running into this error as well on logout. We have a react app and in our main component on componentDidUpdate we call window.Intercom(‘update’) and in the logout, we call window.Intercom(‘shutdown’) and then window.Intercom(‘boot’). Do you think that there could be a weird case where the update and shutdown / boot calls are being interwoven - especially given that the shutdown call probably clears the session?

Hi Andy,

I apologize for not getting back to you. I did not see your response until Seth posted. The error message only says ‘http_post_session_error’. The error is triggered during the ‘boot’ call. The code is minified so I don’t know how helpful this is, but here’s the portion of the stack trace that shows the error:

i	@	frame.376f19e4.js:formatted:8919
H	@	frame.376f19e4.js:formatted:6011
(anonymous)	@	frame.376f19e4.js:formatted:6126
f	@	vendor.7df06146.js:1
c._invoke	@	vendor.7df06146.js:1
e.<computed>	@	vendor.7df06146.js:1
l	@	frame.376f19e4.js:formatted:6045
o	@	frame.376f19e4.js:formatted:6188
Promise.then (async)		
l	@	frame.376f19e4.js:formatted:6050
i	@	frame.376f19e4.js:formatted:6185
(anonymous)	@	frame.376f19e4.js:formatted:6190
n	@	frame.376f19e4.js:formatted:6182
(anonymous)	@	frame.376f19e4.js:formatted:6196
(anonymous)	@	vendor.7df06146.js:1
t.createOrUpdateUser	@	frame.376f19e4.js:formatted:16530
t.createOrUpdateUser	@	frame.376f19e4.js:formatted:17960
boot	@	frame.376f19e4.js:formatted:18127
(anonymous)	@	frame.376f19e4.js:formatted:18198
setIntercomSettings	@	currentuser.reducer.ts:67

setIntercomSettings() contains the code I posted originally. We aren’t directly referencing window.intercomSettings anywhere that I can find. As far as I can tell we are initializing intercom the way it’s described in the spa doc.

@troy @Seth_Killian That error appears if there’s no current session. Is there any other Intercom cal being made by either of you when someone logs out? Also is the Messenger open during this logout process when this error occurs?

We’re also seeing the same error in our React app.

http_post_session_empty
i @ frame.335450bf.js:1
W @ frame.335450bf.js:1
A @ frame.335450bf.js:1
(anonymous) @ frame.335450bf.js:1
l @ vendor.fcde2a65.js:1
(anonymous) @ vendor.fcde2a65.js:1
e.<computed> @ vendor.fcde2a65.js:1
l @ frame.335450bf.js:1
o @ frame.335450bf.js:1
Promise.then (async)
l @ frame.335450bf.js:1
i @ frame.335450bf.js:1
(anonymous) @ frame.335450bf.js:1
(anonymous) @ frame.335450bf.js:1
(anonymous) @ frame.335450bf.js:1
(anonymous) @ vendor.fcde2a65.js:1
t.createOrUpdateUser @ frame.335450bf.js:1
t.createOrUpdateUser @ frame.335450bf.js:1
boot @ frame.335450bf.js:1
(anonymous) @ frame.335450bf.js:1
Intercom @ index.js:79
constructClassInstance @ react-dom.development.js:13308
updateClassComponent @ react-dom.development.js:16985
beginWork$1 @ react-dom.development.js:18505
beginWork$$1 @ react-dom.development.js:23193
performUnitOfWork @ react-dom.development.js:22208
workLoopSync @ react-dom.development.js:22185
renderRoot @ react-dom.development.js:21878
runRootCallback @ react-dom.development.js:21554
(anonymous) @ react-dom.development.js:11353
unstable_runWithPriority @ scheduler.development.js:643
runWithPriority$2 @ react-dom.development.js:11305
flushSyncCallbackQueueImpl @ react-dom.development.js:11349
flushSyncCallbackQueue @ react-dom.development.js:11338
discreteUpdates$1 @ react-dom.development.js:21677
discreteUpdates @ react-dom.development.js:2359
dispatchDiscreteEvent @ react-dom.development.js:5979

We had same error (also react), fixed by using use-intercom-hook library.
It append new intercom script when new user_id and it works without errors.
Demo here:

Hey all :wave:

From what I’ve gathered from our dev team http_post_session_empty is our error thrown when a session is destroyed (aka Intercom(‘shutdown’) ) and we attempt to initiate any network request after that. It’s essentially a race condition. An example of this occurring could be us just attempting to send over metrics on the previous session.

We should be able to handle this better so our dev team will keep :eyes: on this. Since it doesn’t sound like the error is causing any functional issues it could be ignored for now until we prevent it from sending.

Adding a +1 to this, we’re seeing it as well with our react app. We’re using https://github.com/nhagen/react-intercom/tree/2.0

Same here with vue-intercom. It’s not nice at all that our app has errors on logout.

Same here. Angular 8 SPA.