Code quality

Legacy function node in n8n

Why deprecated Function nodes should be migrated to the modern Code node

What is this issue?

The 'Function' and 'Function Item' nodes are deprecated in favor of the unified 'Code' node. While they still work, they lack modern features, won't receive updates, and may be removed in future versions.

Legacy node types:

  • Function node (n8n-nodes-base.function)
  • Function Item node (n8n-nodes-base.functionItem)
  • Old JavaScript execution patterns
  • Pre-1.0 syntax and conventions

Why is this a problem?

No future updates

Deprecated nodes won't receive new features or optimizations.

Missing TypeScript

Code node supports TypeScript; Function nodes don't.

Potential removal

Future n8n versions may remove support for deprecated nodes.

Limited documentation

Official docs focus on the Code node, making troubleshooting harder.

How to fix it

  1. 1

    Replace with Code node

    Create a new Code node and migrate your logic from the Function node.

  2. 2

    Update syntax

    Use the '$input' and 'return' patterns of the Code node instead of legacy patterns.

  3. 3

    Test thoroughly

    The Code node has slightly different behavior—test all edge cases.

  4. 4

    Remove old nodes

    Delete the deprecated Function nodes after successful migration.

Scan your workflow now

Upload your n8n workflow JSON and find deprecated Function nodes that need migration.

Scan for legacy nodes

Related resources

Related code quality issues