qlik-oss / enigma.js

JavaScript library for consuming Qlik's Associative Engine.
MIT License
210 stars 82 forks source link

Unable to close app #838

Closed tboland closed 3 years ago

tboland commented 3 years ago

Description

Connecting to qlik engine using enigma, using openDoc, errors out that "App is already open". Using getActiveDoc() after returns back the wrong Qlik App

Steps to Reproduce

if (!session) session = await enigma.openSession(env.qlikServer, 4747, 'sa_engine', 'INTERNAL'); let global = await session.open(); let app = await global.openDoc(sd.qlikAppId).catch(async (error: any) => { if (error.code === 1002) { return await global.getActiveDoc(); // <--- wrong app being returned } else { logger.error(error); } });

Expected behavior

Some way to close the app

Actual behavior

[What actually happened]

Environment

Library
[x ] Node.js
[ ] Browser
Operating system
[ x] Windows
[ ] OSX
[ ] Linux
Qlik Sense
[ ] Desktop
[ x] Enterprise

Versions

axelssonHakan commented 3 years ago

It's not clear what your function enigma.openSession does. It could be that it opens an app and it's that appId you are getting back on the getActiveDoc()?

There is a function on session.close() that will close the session and therefor also the app unless there is other sessions using that app (same session == same user + same WS URL)

Have you looked at the example https://github.com/qlik-oss/enigma.js/blob/master/examples/authentication/sense-using-certificates/certificates.js Not sure if you are using certificates for Authentification

sublibra commented 3 years ago

Closing this issue due to inactivity. Please reopen the issue if you still are facing the same issue.