The code that I used to create desktop application is working locally. The app is about taking screen shot. When built using electron-builder it is building properly and creating AppImage and snap file for the app. Now my-app.AppImage file when open is working as expected. But the my-app.snap file when installed using snap is not running as expected. Below is the code in app.js
ipcMain.on("start-share", function (event, arg) {
event.reply("uuid", "Screen Started"); // Not going further than this
screenshot().then((img) => {
try {
event.reply("uuid", "Entered Screen Shot");
let imgStr = Buffer.from(img).toString('base64');
var obj = {};
obj.document_1 = imgStr;
var url = 'http://some-url.com/api/workhub/test/task';
axios.post(url, obj)
.then((response) => {
// message = response.data;
event.reply("uuid", response.data);
}).catch(error => {
event.reply("uuid", "Failed Catch Axios");
}).finally(() => {
});
} catch (err) {
event.reply("uuid", "Failed Try Catch Normal");
}
}).catch((err) => {
event.reply("uuid", "Failed Catch Screen Shot");
});
})
package.json file
"name": "my-app",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron ."
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.27.2",
"screenshot-desktop": "^1.12.3"
},
"devDependencies": {
"electron": "^11.1.0"
}
}