Reputation: 123
My project contain a Node server (child) process in Electron app for Windows, which works well in development but fails in production. The project is build using electron-builder and CRA used to automate few set up.
serverProcess = fork(path.join(__dirname, "../server/server.js"), {
env: { PORT: 9090 },
});
Above is the code I am using to create the child process. it exits with uncaughtException.
process.on("uncaughtException", (err) => {
console.error("Uncaught Exception:", err);
logger.error(err);
if (process.send) {
console.log("Server shutting down...", err.stack);
process.send({ type: "error", error: err.message, stack: err.stack });
}
process.exit(5);
});
I am surprised that it works fine in development but not in production, I think creating child process in production needs some more configuration.
Upvotes: 0
Views: 18