# Code - Workflow node | Docs - nodulz

Source: https://nodulz.com/docs/nodes/script_javascript

Language: en

Run custom JavaScript code

## Usage and specifics

Source can be inline, Git or a workspace. Code runs through the container runtime on the selected target. The image, dependencies and repository access must be available on that target.

Technical type : `script_javascript`. Runtime : `docker`.

## Credentials and prerequisites

This node defines no dedicated external credential. Remote sources or execution targets may still need their own access credentials.

See the [credentials guide](/docs/credentials) if a remote source or execution target requires access.

## Parameters

Names below are technical keys. Defaults are not a ready-to-run configuration: complete fields required by your operation. Paths containing [] describe list items; some fields depend on the selected mode.

| Parameter | Type | Default | Values / limits |
| --- | --- | --- | --- |
| `files` | `record` | - | - |
| `directories` | `array` | - | -; max 100 |
| `dependencies` | `array` | `[]` | -; max 16 |
| `libraryIds` | `array` | - | -; max 100 |
| `executionMode` | `literal` | `"sandbox"` | `sandbox`, `docker` |
| `code` | `string` | `"const name = input.name ?? \"world\";\nreturn { message: `Hello ${name}`, nodeKeys: Object.keys(nodes) };"` | - |
| `timeoutMs` | `number` | `10000` | -; ≥ 100, ≤ 120000 |
| `allowedHosts` | `array` | `[]` | - |
| `secretCredentialIds` | `array` | `[]` | - |
| `source` | `union` | `{"kind":"inline","script":"export function run(input) {\n  /** Return an object - usable downstream via nodes.<thisNodeId>.<key> */\n  const { input: triggerInput, nodes: upstream, vars } = input;\n  // API_TOKEN comes from a selected Secret variables credential.\n  const apiToken = process.env.API_TOKEN;\n  return {\n    payload: triggerInput,\n    upstream,\n    vars,\n    hasApiToken: Boolean(apiToken),\n    message: \"Script output ready\",\n  };\n}\n","dependencies":[]}` | - |
| `source.files` | `record` | - | - |
| `source.directories` | `array` | - | -; max 100 |
| `source.kind` | `literal` | `"inline"` | `inline`, `git`, `workspace` |
| `source.script` | `string` | `"export function run(input) {\n  /** Return an object - usable downstream via nodes.<thisNodeId>.<key> */\n  const { input: triggerInput, nodes: upstream, vars } = input;\n  // API_TOKEN comes from a selected Secret variables credential.\n  const apiToken = process.env.API_TOKEN;\n  return {\n    payload: triggerInput,\n    upstream,\n    vars,\n    hasApiToken: Boolean(apiToken),\n    message: \"Script output ready\",\n  };\n}\n"` | - |
| `source.dependencies` | `array` | `[]` | - |
| `source.repo` | `string` | - | -; min 1 |
| `source.branch` | `string` | `"main"` | -; min 1 |
| `source.scriptPath` | `string` | - | -; min 1 |
| `source.credentialId` | `string` | - | - |
| `source.installRoot` | `string` | - | - |
| `source.installCommand` | `string` | - | - |
| `source.workingDir` | `string` | - | - |
| `image` | `string` | - | - |
| `workspaceSource` | `union` | - | - |
| `workspaceSource.kind` | `literal` | - | `upstream`, `node` |
| `workspaceSource.key` | `string` | - | -; min 1 |
| `executionTarget` | `union` | `{"kind":"host"}` | - |
| `executionTarget.kind` | `literal` | `"host"` | `aws_ecs`, `aws_lambda`, `gcp_job`, `gcp_function`, `azure_container`, `azure_function`, `scaleway_job`, `scaleway_function`, `scaleway_container`, `digitalocean_function`, `host`, `remote_server`, `kube`, `swarm` |
| `executionTarget.credentialId` | `string` | - | -; min 1, max 512 |
| `executionTarget.storageCredentialId` | `string` | - | -; min 1, max 512 |
| `executionTarget.bucket` | `string` | - | - |
| `executionTarget.region` | `string` | - | `fr-par`, `nl-ams`, `pl-waw`; max 64 |
| `executionTarget.cluster` | `string` | - | -; min 1, max 512 |
| `executionTarget.taskDefinition` | `string` | - | -; min 1, max 512 |
| `executionTarget.containerName` | `string` | - | -; max 100 |
| `executionTarget.subnets` | `array` | - | -; min 1, max 16 |
| `executionTarget.securityGroups` | `array` | `[]` | -; max 5 |
| `executionTarget.assignPublicIp` | `boolean` | `false` | - |
| `executionTarget.functionName` | `string` | - | -; min 1, max 256 |
| `executionTarget.project` | `string` | - | -; max 100 |
| `executionTarget.jobName` | `string` | - | -; max 100 |
| `executionTarget.endpoint` | `string` | - | -; max 512 |
| `executionTarget.subscriptionId` | `string` | - | - |
| `executionTarget.resourceGroup` | `string` | - | -; max 90 |
| `executionTarget.functionApp` | `string` | - | -; max 100 |
| `executionTarget.jobId` | `string` | - | - |
| `executionTarget.functionId` | `string` | - | - |
| `executionTarget.containerId` | `string` | - | - |
| `executionTarget.namespaceId` | `string` | - | - |
| `executionTarget.serverId` | `string` | - | -; min 1 |
| `executionTarget.provider` | `enum` | - | `aws`, `gcp`, `scaleway`, `ovh`, `azure`, `digitalocean`, `hetzner` |
| `executionTarget.clusterId` | `string` | - | -; min 1 |
| `executionTarget.namespace` | `string` | - | - |

## Configuration help

| Setting | Purpose and guidance |
| --- | --- |
| `dependencies`<br>Dependencies | One dependency per line (pip, npm@version, or CRAN package for R) |
| `dependencies`<br>Dependencies | Extra packages installed on every run, in addition to requirements.txt or package.json. |
| `image`<br>Container image | Image used to run the script (e.g. docker.io/library/node:22-bookworm). Use localhost/name:tag for a local Podman image. |
| `secretCredentialIds`<br>Secrets | Secrets connections injected as environment variables of the script (process.env, os.environ...). The file carrying them is deleted as soon as the container starts. |

## Initial configuration

Initial catalog configuration example, to adapt before running. Keep secrets in credentials.

```json
{
  "source": {
    "kind": "inline",
    "script": "export function run(input) {\n  /** Return an object - usable downstream via nodes.<thisNodeId>.<key> */\n  const { input: triggerInput, nodes: upstream, vars } = input;\n  // API_TOKEN comes from a selected Secret variables credential.\n  const apiToken = process.env.API_TOKEN;\n  return {\n    payload: triggerInput,\n    upstream,\n    vars,\n    hasApiToken: Boolean(apiToken),\n    message: \"Script output ready\",\n  };\n}\n",
    "dependencies": []
  },
  "executionTarget": {
    "kind": "host"
  }
}
```

## Verification

Test with representative data. Check node output in the inspector and logs, then use editor mapping for downstream fields. A trigger test with a simulated payload does not validate external service delivery.

See also : [Expressions and data](/docs/expressions), [Executions](/docs/executions), [Node catalog](/docs/nodes).

## Explore further

- [Features - nodulz](https://nodulz.com/product/overview)
- [Node catalog - nodulz](https://nodulz.com/product/catalog)
- [MCP server - nodulz](https://nodulz.com/product/mcp)
- [Pricing - nodulz](https://nodulz.com/pricing)
- [Use cases and workflow automation - nodulz](https://nodulz.com/use-cases)
- [Choose what your workflows can do. - nodulz](https://nodulz.com/compare)
- [Documentation - nodulz](https://nodulz.com/docs)
