I have a problem in Nodejs, the sessionData variable gets its value from a database, in the case that this value exists new client must be executed, the problem I have is that when I run all the code first to run is new client and then get the data from sessionData, how can I do to first get the value of sessionData and then run new client
let sessionData
(async() => {
sessionData = await cargarSession()
console.log('Mi objeto recibido', sessionData)
//return sessionData
})();
const wa = new Client({
restartOnAuthFail: true,
puppeteer: {
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--no-first-run',
'--no-zygote',
'--single-process',
'--disable-gpu',
'--use-gl=egl'
],
},
session: sessionData
})