In order to limit the number of WebSockets opened, Qlik Sense will close the WebSocket connection immediately after getting the app list, which is getting interpreted as an error.
Use app.global.getAppList(), which keeps the WebSocket open. app.global is intended to be used if there are several API calls that need to be done.
const global = qlik.getGlobal(...)
[...thousand of lines later....]
global.getAppList()
For the sample code mentioned above, it will look like this: