Hi I have written the following code that communicates with qliksense server and convert QVF file as json using node JS. When I'm trying to do it I'm getting the following error.
(node:21220) UnhandledPromiseRejectionWarning: #<ErrorEvent>
(node:21220) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21220) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Please find the below code that I'm using
ipcMain.on('migration:qlik',async(w,options)=>{
try
{
console.log("********************************* Qlik to PBI *****************************")
var options = JSON.parse(options)
console.log(options)
options['application_info'].map((appToBeMig)=>{
qvfToJson.qvfToJson()
.then((certificates)=>{
console.log(certificates)
var server = store.get('qlik_server')
var userDir = store.get('qlik_user_dir')
var userID = store.get('qlik_user_id')
let session = enigma.create({
schema,
url: `wss://${server}}:4747/app/engineData`,
createSocket: url => new WebSocket(url, {
ca: certificates.root,
cert: certificates.cert,
key: certificates.key,
headers: {
'X-Qlik-User': `UserDirectory=${userDir}; UserId=${userID}`
}
}),
})
session.open().then((global) => {
global.openDoc(appToBeMig['app_id']).then((doc)=>{
serializeapp(doc)
.then((appData)=>{
session.close().then(() => console.log("session closed"))
console.log(JSON.stringify(appData))
// resolve(JSON.stringify(appData))
// console.log(appData.properties)
// let data = JSON.stringify(result);
// var appName = utils.cleanString(appData.properties.qTitle);
// fs.mkdir(appName, function(result)
// {
// writeFiles(appData, appName, '527d85fa-f33f-4437-8a91-26d450941e73');
// session.close()
// })
})
});
});
}).catch(function(){console.log("Error")})
})
}
catch(err)
{
console.log(err)
}
})
please help me on resolving this issue