Upgrade broke $input behavior in CODE after 0.219?

Describe the issue/error/question

My automations worked fine up through version 0.219.1

Last night I upgraded to 0.221.2 and many of them broke. Debugging, it seems that $input.first().json and input.all() are empty, even when there is input visible in the editor.

Downgraded to 0.221.0 and still had the same problem.

Downgraded to 0.219.1 and the problem has gone away.

Do I need to update my code? This can’t be a widespread problem or it would be affecting a lot of people.

What is the error message (if any)?

console.log($input.all()) and console.log($input.first().json) are empty even when there is input visible in editor.

Please share the workflow

It’s a big automation. Here’s a snippet:

Information on your n8n setup

  • 0.219.1 works. Doesn’t work with 0.221.0 or 0.221.2. Didn’t test other versions
  • Database: MySQL
  • Mode: Own
  • Running on Amazon EC2 t4g.medium running Ubuntu 22.04.2 LTS

I am so sorry for the trouble @Lee_S :frowning:

@Jon could this be related to the other Code-node problems involving MySQL data you were looking at earlier?

This seems to be ok for me on 0.221.2

@Lee_S are you able to share the output of the MySQL node? It shouldn’t matter but where in your code node do you see the issue?

Would you also be able to try the workflow below and let me know if it works?

1 Like

Testing your sample now.

I’m happy to snapshot the instance and spin up a replica where I can give you web and console access if that would help with debugging.

Lee

One thing I just noticed you said the workflows were broken and that you found the inputs were not working, What was the actual error you were seeing?

Sorry, took me a moment to spin up a replica. I can’t keep changing the n8n version on the production server.

The simple test script you posted above works fine on 0.221.2. However, my script breaks in the same place it was breaking before. So there must be something more complicated going on.

The error I get is ERROR: Code doesn’t return items properly. I think that’s because it gets past the first test if ($input.first().json.length == 0) and I think the main loop for (const item of $input.all()) is empty. So the next step results = allmsgs; return results; returns null.

When I downgrade the replica to 0.219.1 it works as before.

It’d be pretty easy to give you access to the replica. Send me a DM or email for access details.

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