Duaer

Integrations

Common issues with Code in Duaer

Common Code node issues in Duaer: return format, import, modules, network access, credentials, and Python.

Code does not return items properly

Duaer passes an array of objects between nodes, and each object’s json key points to another object. The Code node must return that shape:

return [
  { json: { name: 'Ada', score: 92 } },
  { json: { name: 'Lin', score: 88 } },
];

A json key that holds an array, no return value, or undefined all fail. For undefined, check that the fields you reference exist on every run.

'import' and 'export' may only appear at the top level

The Code node’s JavaScript sandbox does not support import or export. Use require instead: const lodash = require('lodash');

Cannot find module '<module>'

Only a self-hosted Duaer can load extra modules in the Code node:

  1. Install the module where Duaer runs. With Docker, build a custom image from your Duaer image with the module installed.
  2. Set NODE_FUNCTION_ALLOW_BUILTIN (built-in modules) and NODE_FUNCTION_ALLOW_EXTERNAL (external modules) to the allowed names, then restart.

fetch or axios fails in the Code node

The Duaer Code node runs in a sandbox with no network access, so fetch, axios, and http modules fail. Make the request with the HTTP Request node, then process its output in the Code node.

The Code node cannot read credentials

By design, the Code node cannot read Duaer credentials, so secrets cannot leak. Send authenticated requests with HTTP Request. To pick credentials by condition:

  • Route with a Switch node to nodes that use different credentials.
  • Use Custom Auth in HTTP Request and set headers, query parameters, or body with expressions.

Keep data between runs

Store a little data with $getWorkflowStaticData('global') or $getWorkflowStaticData('node'), such as the date of the last report. To avoid processing the same items twice, the Remove Duplicates node is simpler.

Python errors

  • The Python option cannot import anything unless the instance admin allows it.
  • Python does not support the _ helpers, except _items in all-items mode and _item in per-item mode.
  • When the instance disables Python, the node fails at once. A self-hosted admin sets DUAER_PYTHON_ENABLED to true, or removes it, and restarts.

Refer to Python.

Questions

Can the Duaer Code node make HTTP requests?

No. The Duaer Code node sandbox has no network access. Use the HTTP Request node, then process the result in Code.

Can the Duaer Code node use credentials?

No. Duaer does not let the Code node read credentials. Send authenticated calls with HTTP Request.

In this section