Cannot convert undefined or null to object

Hi

Describe the problem/error/question

I would like to do the following:
Load Data (here Dummy Data), which contains several items. (done)
Select an age (in this example) in a node (here Select using the Set Node). (done).

Now, I would like in a separate node (here called Code1) as an output, only the items, which contain the selected age.

I posted my workflow code below. I receive an error message called Cannot convert undefined or null object. Any advice would be much appreciated as to how to do that.

Thank you for your help.
Bernd

What is the error message (if any)?

Problem in node ‘Code1‘
Cannot convert undefined or null to object

TypeError: Cannot convert undefined or null to object
    at Function.entries (<anonymous>)

Please share your workflow

Share the output returned by the last node

ERROR: Cannot convert undefined or null to object

Information on your n8n setup

  • **n8n version: Version 0.222.3
  • **Running n8n via npm
  • **Operating system: macOS Monterey

Hi Bernd,

It seems you could achieve this much more easily using the “Filter” node.

Here is an example:

Hey @bssei, the issue is that in the last code node return [{json: data}]; is evaluating to return [{json: undefined}]; and n8n isn’t properly handling user code returning undefined values like that.
Just created a PR to handle this.

Thank you, @netroy. Much appreciated.

Hi @romain-n8n,

Thank you. I will use the Filter node for the time being.

Kind regards
Burkhard

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