My node Code runs infinitely

Describe the problem/error/question

The code node keeps executing infinitely. I tested it in another workflow with simulated information and it worked, but in the main workflow it just keeps executing infinitely. I tried adding this 30s sleep, but it stayed the same. All other information exists, and the output from previous nodes is ok.

What is the error message (if any)?

there is no error message anymore, just infinite execution. Before I put the environment variable, I got this error:
Task execution timed out after 300 seconds
The task runner was taking too long on this task, so it was suspected of being unresponsive and restarted, and the task was aborted. You can try the following: 1. Optimize your script to prevent long-running tasks, e.g. by processing data in smaller batches. 2. Ensure that all paths in your script are able to terminate, i.e. no infinite loops. 3. If your task can reasonably take more than 300 seconds, increase the timeout using the N8N_RUNNERS_TASK_TIMEOUT environment variable.

Please share your workflow

Information on your n8n setup

  • n8n version: last
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Arch Linux

Hi,

Have a look at your code. You have put a sleep thread for 30s.

const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));

// Aguarda 30 segundos (30000 milissegundos)
await sleep(30000);

hi! yes, but it’s not taking 30 seconds; the node has been running for more than 15 minutes and nothing has happened.

Have you debugged through your code? Check how many tags are there and what are your breaks.

for (const tag of tags) {
  if (totalCharCount + tag.length <= 500) {
    tagsFinal.push(tag);
    totalCharCount += tag.length;
  } else {
    break;
  }
}

sorry i didnt get it, this is working in other workflow

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.