Quiero enviar una notificación push con una solicitud http y luego llamar a la función process.exit() pero no funciona, el proceso se detiene pero la notificación push no se envía. Funciona si elimino la función process.exit. Aquí está el código:
await page .waitForSelector(".guest", { timeout: 5000 }) .then(async () => { console.log("Not logged in, exiting"); await pushNotification("App has stopped, probably session expired."); process.exit(); }) async function pushNotification(msg) { var options = { method: "POST", url: "url", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ to: "", title: "", body: ``, }), }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); }); }