@raevon/n8n-nodes-whatsapp 2.0.9 → 2.0.10

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.
@@ -345,20 +345,20 @@ async function startServer(cfg) {
345
345
  }
346
346
  async function ensureServerRunning(cfg) {
347
347
  const port = getPort(cfg);
348
- // Port is free start server
349
- if (await isPortOpen(port)) {
350
- await startServer(cfg);
351
- return;
352
- }
353
- // Port is in use — check if server responds
348
+ // Try to connect to existing server first
354
349
  try {
355
- const res = await fetch(`http://127.0.0.1:${port}/health`, { signal: AbortSignal.timeout(3000) });
350
+ const res = await fetch(`http://127.0.0.1:${port}/health`, { signal: AbortSignal.timeout(5000) });
356
351
  if (res.ok)
357
- return; // Server alive, use it
352
+ return; // Server alive
358
353
  }
359
354
  catch { }
360
- // Port in use but not respondingstale process, needs container restart
361
- throw new Error(`Port ${port} occupied. Use "Stop Server" first, or restart n8n container.`);
355
+ // Server not runningstart it
356
+ if (await isPortOpen(port)) {
357
+ await startServer(cfg);
358
+ return;
359
+ }
360
+ // Port occupied by something else
361
+ throw new Error(`Port ${port} occupied by another process. Restart n8n container to clear.`);
362
362
  }
363
363
  async function stopServer(cfg) {
364
364
  const port = getPort(cfg);
@@ -79,13 +79,14 @@ class WhatsAppConnect {
79
79
  continue;
80
80
  }
81
81
  try {
82
- const response = await fetch(`${(0, WhatsAppApiHelper_1.getServerUrl)(cfg)}/connect`, { method: 'POST' });
82
+ const serverUrl = (0, WhatsAppApiHelper_1.getServerUrl)(cfg);
83
+ const response = await fetch(`${serverUrl}/connect`, { method: 'POST', signal: AbortSignal.timeout(60000) });
83
84
  const result = await response.json();
84
85
  returnData.push({ json: { ...result, sessionPath: cfg.sessionPath }, pairedItem: { item: i } });
85
86
  }
86
87
  catch (err) {
87
88
  returnData.push({
88
- json: { connected: false, error: `Server unreachable: ${err.message}`, sessionPath: cfg.sessionPath },
89
+ json: { connected: false, error: `Connect failed: ${err.message}`, sessionPath: cfg.sessionPath },
89
90
  pairedItem: { item: i },
90
91
  });
91
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raevon/n8n-nodes-whatsapp",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
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",