qlik-oss / enigma.js

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

getDocList in Qlik Cloud instance #991

Closed jansivans closed 11 months ago

jansivans commented 11 months ago

I am having problem connecting via enigma and executing getDocList if Qlik cloud is used. When we used Qlik locally, I could successfully connect to Qlik via enigma in nodejs:

    const session = await enigma.create({
        schema,
        url: `${config.url}/app/${appId}/ttl/300`,
        createSocket: (url) => new WebSocket(url,
            {
                ca: [readCert('root.pem')],
                key: readCert('client_key.pem'),
                cert: readCert('client.pem'),
                headers: {
                    'X-Qlik-User': `UserDirectory=${userDirectory}; UserId=${user}`,
                },
            }
        ),
    });

Now we moved to Qlik Cloud and I do something like this:

        const session = await enigma.create({
            schema,
            url: `wss://${config.qlikTenant}/app/${appId}`,
            createSocket: (url) => new WebSocket(url,
                {
                    headers: {
                        Authorization: `Bearer ${config.qlikAdminApiKey}`,
                    },
                }
            ),
        });

In some cases I want to list apps using this code (in this case appId is undefined):

    let qix = await session.open();
    const apps = await qix.getDocList();

Before (when Qlik was used locally) - everything worked fine. But when used with Qlik cloud and appId is undefined, I can’t list apps - it says “Socket closed”. Also tried to use engineData instead of actual appId:

jansivans commented 11 months ago

I have asked the same question in Qlik Slack - https://qlikdeveloper.slack.com/archives/C3FKGA7UZ/p1699538981661979. Some person answered me that this issue can be reproduced. So I thought I'll write it also in GitHub so we can track progress on this issue.

jansivans commented 11 months ago

Qlik team said that engineData is not available in Qlik cloud. REST API should be used for app fetching: https://*.qlikcloud.com/api/v1/items?resourceType=app