When running a self-hosted version of n8n, you have to mount the n8n-task-runners.json file in the docker container and then either directly change "N8N_RUNNERS_STDLIB_ALLOW": "*" in the file or either add "N8N_RUNNERS_STDLIB_ALLOW" to the allowed-env array.
Here is an example docker-compose.yml file showing the implementation for the second option:
---
services:
n8n:
image: n8nio/n8n:1.121.1
restart: always
environment:
- N8N_RUNNERS_ENABLED=true
- N8N_RUNNERS_MODE=external
- N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
- N8N_NATIVE_PYTHON_RUNNER=true
ports:
- "5678:5678"
volumes:
- n8n_storage:/home/node/.n8n
runner:
image: n8nio/runners:1.121.1
restart: always
env_file: n8n.env
environment:
- N8N_RUNNERS_TASK_BROKER_URI=http://n8n:5679
- N8N_RUNNERS_STDLIB_ALLOW=*
volumes:
- ./n8n-task-runners.json:/etc/n8n-task-runners.json
depends_on:
- n8n
volumes:
n8n_storage:
And the n8n-task-runners.json file:
{
"task-runners": [
{
"runner-type": "javascript",
"workdir": "/home/runner",
"command": "/usr/local/bin/node",
"args": [
"--disallow-code-generation-from-strings",
"--disable-proto=delete",
"/opt/runners/task-runner-javascript/dist/start.js"
],
"health-check-server-port": "5681",
"allowed-env": [
"PATH",
"GENERIC_TIMEZONE",
"NODE_OPTIONS",
"N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT",
"N8N_RUNNERS_TASK_TIMEOUT",
"N8N_RUNNERS_MAX_CONCURRENCY",
"N8N_SENTRY_DSN",
"N8N_VERSION",
"ENVIRONMENT",
"DEPLOYMENT_NAME"
],
"env-overrides": {
"NODE_FUNCTION_ALLOW_BUILTIN": "crypto",
"NODE_FUNCTION_ALLOW_EXTERNAL": "moment",
"N8N_RUNNERS_HEALTH_CHECK_SERVER_HOST": "0.0.0.0"
}
},
{
"runner-type": "python",
"workdir": "/home/runner",
"command": "/opt/runners/task-runner-python/.venv/bin/python",
"args": ["-m", "src.main"],
"health-check-server-port": "5682",
"allowed-env": [
"PATH",
"N8N_RUNNERS_LAUNCHER_LOG_LEVEL",
"N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT",
"N8N_RUNNERS_TASK_TIMEOUT",
"N8N_RUNNERS_MAX_CONCURRENCY",
"N8N_RUNNERS_STDLIB_ALLOW",
"N8N_SENTRY_DSN",
"N8N_VERSION",
"ENVIRONMENT",
"DEPLOYMENT_NAME"
],
"env-overrides": {
"PYTHONPATH": "/opt/runners/task-runner-python",
"N8N_RUNNERS_EXTERNAL_ALLOW": ""
}
}
]
}