Archiving and Replaying Slack

I’m trying to record and play back a Slack site and all I see when attempting to replay is an error:

Sorry, the URL https://app.slack.com/auth?app=client&return_to=%2Fclient%2FT07UZDETW%2FC07UZDHAQ&teams= is not in this archive.

Do you have any advice on how to debug or fix this?

I think in the case of Slack, its likely the lack of websocket support in web archives.
Slack relies on websockets, and those connections are not able to be reestablished in a webarchive, so it generally breaks.
A possible workaround might be to try to capture Slack on a browser with websockets disabled (is this possible? hmm can experiment) and see if that would work better, or, to try to capture and replay websocket data (harder!)

2 Likes

I was able to turn off websockets in Firefox and confirm that Slack still work by setting network.websocket.max-connections=0 in about:config. I thought I might be able to do this in Chrome following some advice over on StackOverflow by starting chrome with --disable-web-sockets. But it didn’t seem to actually disable web-sockets when I tested with http://websocketstest.com/

I then tried disabling sockets with arthepsy/chrome-disable-websockets. It did disable websockets, but I think in such a way that actually broke the Slack JavaScript application. Here’s an error I see in the console when attempting to load the Slack site in my browser with the chrome-disable-websockets extension enabled.

gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1 Uncaught ReferenceError: WebSocket is not defined 
    at Object.6TBL (gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1)    at g (T07UZDETW:1)
    at Object.3PKk (gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1)
    at g (T07UZDETW:1)
    at Object.RtFF (gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1)
    at g (T07UZDETW:1)
    at Object.Zrl3 (gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1)
    at g (T07UZDETW:1)
    at Object.2XU3 (gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1)
    at g (T07UZDETW:1)
    at Object.+cPl (gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1)
    at g (T07UZDETW:1)
    at Object.7dYf (gantry-shared.eaf6fee.min.js?cacheKey=gantry-1619136710:1)
    at g (T07UZDETW:1)

The plugin works by setting window.WebSocket = undefined so that’s the cause of course. Setting network.websocket.max-connections=0 in Firefox on the other hand doesn’t remove window.WebSocket, it just prevents connections from being made. So I guess that’s the difference there.

1 Like

Thanks for looking into this. The ArchiveWeb.page extension can actually disable websockets itself, simply by overriding the WebSocket class… I tried that, but turns out it was not the issue.

The actual issue was lack of archiving of window.localStorage and window.sessionStorage, where information about current login is stored. By saving this data and recreating it on replay, I was able to get Slack to work.
But, just like saving cookies, this is something to be careful about, or at least when it comes to later sharing these archives.
I’m not sure yet if it’s something that should be enabled by default, without an option to disable…

3 Likes

Thanks for looking into it, and figuring out the problem! Was there a hint that clued you into it being a window.localStorage issue? It does seem like it would be a nice thing to enable somehow, I’d be interested to see how you did it.

2 Likes

@ilya was it easy-ish to save the window.localStorage and window.sessionStorage objects and recreating it on playback? I would like to try it out. I can always change my credentials after the recording is completed.