@raevon/n8n-nodes-whatsapp 2.0.0 → 2.0.2

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,16 @@ async function ensureServerRunning(cfg) {
61
60
  DAILY_SEND_LIMIT: String(cfg.dailySendLimit),
62
61
  CHECK_RECIPIENT: String(cfg.checkRecipientExists),
63
62
  };
64
- serverProcess = (0, node_child_process_1.spawn)('node', [serverPath], {
65
- env,
66
- stdio: 'ignore',
67
- detached: true,
68
- });
69
- serverProcess.unref();
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: 'pipe' });
67
+ }
68
+ catch (err) {
69
+ const stderr = err.stderr ? err.stderr.toString() : '';
70
+ const stdout = err.stdout ? err.stdout.toString() : '';
71
+ throw new Error(`Failed to start WhatsApp server: ${err.message} | stdout: ${stdout} | stderr: ${stderr}`);
72
+ }
70
73
  serverPort = port;
71
74
  // Wait for server to start (up to 10s)
72
75
  const started = await new Promise((resolve) => {
@@ -83,7 +86,13 @@ async function ensureServerRunning(cfg) {
83
86
  }, 500);
84
87
  });
85
88
  if (!started) {
86
- throw new Error('WhatsApp server failed to start within 10 seconds');
89
+ // Read log for error details
90
+ let logContent = '';
91
+ try {
92
+ logContent = node_fs_1.default.readFileSync(`/tmp/whatsapp-server-${port}.log`, 'utf-8');
93
+ }
94
+ catch { }
95
+ throw new Error(`WhatsApp server failed to start. Log: ${logContent.slice(0, 500)}`);
87
96
  }
88
97
  }
89
98
  async function disconnect() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raevon/n8n-nodes-whatsapp",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "n8n community node for WhatsApp — send and receive messages with anti-ban protection via the Baileys library",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",