Describe the issue/error/question
I have a while loop that I use to pull some values from multiple 2 value arrays. It has been working fine for months. I went to edit it today to add something to my message and now I get error, even with the original code. The error is saying it cannot access a null value. However, if I run the same code outside the loop it works fine. I tried .pop, but I was using [1] in place of where .pop() was. Both give me similar errors.
With .pop(): ERROR: Cannot read property ‘pop’ of null [Line 15 | Item Index: 0]
With [1]: ERROR: Cannot read property ‘1’ of null [Line 15 | Item Index: 0]
What is the error message (if any)?
Please share the workflow
while(counter < len ){
let regMsg = msg.exec(data[counter].message).pop();
let regUser = user.exec(data[counter].message).pop();
let regSrcip = srcip.exec(data[counter].message).pop();
message = message + "User: " + regUser + " had a successful Admin Login into " + data[counter].hostname + " on " + data[counter].display_received_at + " from " + regSrcip + "\n" + "\n" ;
counter++;
}
(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database you’re using (default: SQLite):
- Running n8n with the execution process [own(default), main]:
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: