@raevon/n8n-nodes-whatsapp 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -47,7 +47,6 @@ async function ensureServerRunning(cfg) {
|
|
|
47
47
|
if (!node_fs_1.default.existsSync(serverPath)) {
|
|
48
48
|
throw new Error(`WhatsApp server not found at ${serverPath}`);
|
|
49
49
|
}
|
|
50
|
-
// Start the server as background process
|
|
51
50
|
const env = {
|
|
52
51
|
...process.env,
|
|
53
52
|
WHATSAPP_SESSION_PATH: cfg.sessionPath,
|
|
@@ -61,12 +60,14 @@ async function ensureServerRunning(cfg) {
|
|
|
61
60
|
DAILY_SEND_LIMIT: String(cfg.dailySendLimit),
|
|
62
61
|
CHECK_RECIPIENT: String(cfg.checkRecipientExists),
|
|
63
62
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
63
|
+
// Use nohup + background for Docker compatibility
|
|
64
|
+
const cmd = `nohup node "${serverPath}" > /tmp/whatsapp-server-${port}.log 2>&1 &`;
|
|
65
|
+
try {
|
|
66
|
+
(0, node_child_process_1.execSync)(cmd, { env, stdio: 'ignore' });
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
throw new Error(`Failed to start WhatsApp server: ${err.message}`);
|
|
70
|
+
}
|
|
70
71
|
serverPort = port;
|
|
71
72
|
// Wait for server to start (up to 10s)
|
|
72
73
|
const started = await new Promise((resolve) => {
|
|
@@ -83,7 +84,13 @@ async function ensureServerRunning(cfg) {
|
|
|
83
84
|
}, 500);
|
|
84
85
|
});
|
|
85
86
|
if (!started) {
|
|
86
|
-
|
|
87
|
+
// Read log for error details
|
|
88
|
+
let logContent = '';
|
|
89
|
+
try {
|
|
90
|
+
logContent = node_fs_1.default.readFileSync(`/tmp/whatsapp-server-${port}.log`, 'utf-8');
|
|
91
|
+
}
|
|
92
|
+
catch { }
|
|
93
|
+
throw new Error(`WhatsApp server failed to start. Log: ${logContent.slice(0, 500)}`);
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
async function disconnect() {
|
package/package.json
CHANGED