Help with Setting up a Task Runner

Hey everyone,

I’m encountering a persistent issue with the “Code in Python (Native) (Beta)” node in n8n, and I’d greatly appreciate some help troubleshooting it.

Problem Description:
After deploying and setting up a task runner alongside my n8n instance, I consistently receive the following error message in the n8n UI when trying to execute a “Code in Python (Native) (Beta)” node:

Problem in node ‘Code in Python (Native) (Beta)‘ To use native Python, please use runners by setting N8N_RUNNERS_ENABLED=true.

This is baffling because I already have a functioning n8n worker, and I’ve explicitly set the environment variable N8N_RUNNERS_ENABLED to true on both the main n8n instance and the worker.

To further confirm, I’ve checked the worker logs, and I can see this line:

To use native Python, please use runners by setting `N8N_RUNNERS_ENABLED=true`.

It seems like the worker is somehow not recognizing that the N8N_RUNNERS_ENABLED flag is indeed set to true, even though it’s present in the environment.

Below is the redacted Zeabur (a PaaS hosting/deployment platform) YAML file template for my project, which details the deployment configuration. This may help pinpoint any missed configurations or potential conflicts.

Could anyone provide some insights or suggestions on what might be causing this issue? Is there a common pitfall I might be missing, or a specific way N8N_RUNNERS_ENABLED needs to be configured in a distributed setup with task runners?

Thanks so much in advance for your help!

# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: n8n-with-worker-aticne
spec:
    description: Exported from project 691ae13042a1e8e7978949a6
    icon: https://i.imgur.com/KUcP61Z.png
    services:
        - name: n8n-main
          icon: https://i.imgur.com/KUcP61Z.png
          template: PREBUILT_V2
          spec:
              source:
                  image: docker.io/n8nio/n8n:latest
              ports:
                  - id: web
                    port: 5678
                    type: HTTP
                  - id: port-5679
                    port: 5679
                    type: HTTP
              volumes:
                  - id: data
                    dir: /root/.n8n
              instructions:
                  - title: N8N ENCRYPTION KEY
                    content: ${N8N_ENCRYPTION_KEY}
              env:
                  DB_POSTGRESDB_DATABASE:
                      default: ${POSTGRES_DB}
                      expose: false
                  DB_POSTGRESDB_HOST:
                      default: ${POSTGRES_HOST}
                      expose: false
                  DB_POSTGRESDB_PASSWORD:
                      default: ${POSTGRES_PASSWORD}
                      expose: false
                  DB_POSTGRESDB_PORT:
                      default: ${POSTGRES_PORT}
                      expose: false
                  DB_POSTGRESDB_USER:
                      default: ${POSTGRES_USERNAME}
                      expose: false
                  DB_TYPE:
                      default: postgresdb
                      expose: false
                  EXECUTIONS_MODE:
                      default: queue
                      expose: false
                  EXPRESS_TRUST_PROXY:
                      default: "true"
                      expose: false
                  GENERIC_TIMEZONE:
                      default: "****"
                      expose: false
                  N8N_ENCRYPTION_KEY:
                      default: ${PASSWORD}
                      expose: false
                  N8N_ENCRYPTION_KEY_WORKER:
                      default: ${N8N_ENCRYPTION_KEY}
                      expose: true
                  N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS:
                      default: "true"
                      expose: false
                  N8N_EXPRESS_TRUST_PROXY:
                      default: "true"
                      expose: false
                  N8N_HOST:
                      default: ${ZEABUR_WEB_DOMAIN}
                      expose: false
                  N8N_NATIVE_PYTHON_RUNNER:
                      default: "true"
                      expose: false
                  N8N_RUNNERS_AUTH_TOKEN:
                      default: "****"
                      expose: false
                  N8N_RUNNERS_BROKER_LISTEN_ADDRESS:
                      default: 0.0.0.0
                      expose: false
                  N8N_RUNNERS_BROKER_LOG_LEVEL:
                      default: info
                      expose: false
                  N8N_RUNNERS_BROKER_PORT:
                      default: "5679"
                      expose: false
                  N8N_RUNNERS_ENABLED:
                      default: "true"
                      expose: true
                  N8N_RUNNERS_MODE:
                      default: external
                      expose: false
                  NODE_ENV:
                      default: production
                      expose: false
                  NODE_FUNCTION_ALLOW_BUILTIN:
                      default: "*"
                      expose: false
                  OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS:
                      default: "true"
                      expose: false
                  PUBLIC_DOMAIN:
                      default: automatus
                      expose: false
                  QUEUE_BULL_REDIS_HOST:
                      default: ${REDIS_HOST}
                      expose: false
                  QUEUE_BULL_REDIS_PASSWORD:
                      default: ${REDIS_PASSWORD}
                      expose: false
                  QUEUE_BULL_REDIS_PORT:
                      default: ${REDIS_PORT}
                      expose: false
                  REDIS_PASSWORD:
                      default: "****"
                      expose: false
                  TZ:
                      default: "****"
                      expose: false
                  WEBHOOK_URL:
                      default: "****"
                      expose: false
              configs: []
              portForwarding:
                  enabled: false
        - name: n8n-worker
          icon: https://i.imgur.com/KUcP61Z.png
          template: PREBUILT_V2
          spec:
              source:
                  image: docker.io/n8nio/n8n:latest
                  command:
                      - /bin/sh
                  args:
                      - -c
                      - n8n worker
              volumes:
                  - id: data
                    dir: /root/.n8n
              env:
                  DB_POSTGRESDB_DATABASE:
                      default: ${POSTGRES_DB}
                      expose: false
                  DB_POSTGRESDB_HOST:
                      default: ${POSTGRES_HOST}
                      expose: false
                  DB_POSTGRESDB_PASSWORD:
                      default: ${POSTGRES_PASSWORD}
                      expose: false
                  DB_POSTGRESDB_PORT:
                      default: ${POSTGRES_PORT}
                      expose: false
                  DB_POSTGRESDB_USER:
                      default: ${POSTGRES_USERNAME}
                      expose: false
                  DB_TYPE:
                      default: postgresdb
                      expose: false
                  EXECUTIONS_MODE:
                      default: queue
                      expose: false
                  GENERIC_TIMEZONE:
                      default: "****"
                      expose: false
                  N8N-MAIN_PASSWORD:
                      default: "****"
                      expose: false
                  N8N_ENCRYPTION_KEY:
                      default: ${N8N_ENCRYPTION_KEY_WORKER}
                      expose: false
                  N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS:
                      default: "true"
                      expose: false
                  N8N_HOST:
                      default: ${ZEABUR_WEB_DOMAIN}
                      expose: false
                  N8N_RUNNERS_AUTH_TOKEN:
                      default: "****"
                      expose: false
                  N8N_RUNNERS_ENABLED:
                      default: "true"
                      expose: false
                  N8N_RUNNERS_MODE:
                      default: external
                      expose: false
                  NODE_ENV:
                      default: production
                      expose: false
                  NODE_FUNCTION_ALLOW_BUILTIN:
                      default: "*"
                      expose: false
                  PUBLIC_DOMAIN:
                      default: "****"
                      expose: false
                  QUEUE_BULL_REDIS_HOST:
                      default: ${REDIS_HOST}
                      expose: false
                  QUEUE_BULL_REDIS_PASSWORD:
                      default: ${REDIS_PASSWORD}
                      expose: false
                  QUEUE_BULL_REDIS_PORT:
                      default: ${REDIS_PORT}
                      expose: false
                  REDIS_PASSWORD:
                      default: "****"
                      expose: false
                  WEBHOOK_URL:
                      default: ${ZEABUR_WEB_URL}
                      expose: false
              configs: []
        - name: Redis
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/redis.svg
          template: PREBUILT_V2
          spec:
              source:
                  image: redis/redis-stack-server:latest
              ports:
                  - id: database
                    port: 6379
                    type: TCP
              volumes:
                  - id: data
                    dir: /data
              instructions:
                  - title: Command to connect to your Redis
                    content: redis-cli -h ${PORT_FORWARDED_HOSTNAME} -p ${DATABASE_PORT_FORWARDED_PORT} -a ${REDIS_PASSWORD}
                  - title: Redis Connection String
                    content: redis://:${REDIS_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}
                  - title: Redis password
                    content: ${REDIS_PASSWORD}
                  - title: Redis host
                    content: ${PORT_FORWARDED_HOSTNAME}
                  - title: Redis port
                    content: ${DATABASE_PORT_FORWARDED_PORT}
              env:
                  PUBLIC_DOMAIN:
                      default: "****"
                      expose: false
                  REDIS_ARGS:
                      default: --requirepass ${REDIS_PASSWORD}
                      expose: false
                  REDIS_CONNECTION_STRING:
                      default: redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}
                      expose: true
                  REDIS_HOST:
                      default: ${CONTAINER_HOSTNAME}
                      expose: true
                  REDIS_PASSWORD:
                      default: ${PASSWORD}
                      expose: true
                  REDIS_PORT:
                      default: ${DATABASE_PORT}
                      expose: true
                  REDIS_URI:
                      default: ${REDIS_CONNECTION_STRING}
                      expose: true
              configs: []
              portForwarding:
                  enabled: true
        - name: postgresql
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT_V2
          spec:
              source:
                  image: postgres:17
                  command:
                      - docker-entrypoint.sh
                      - -c
                      - config_file=/etc/postgresql/postgresql.conf
              ports:
                  - id: database
                    port: 5432
                    type: TCP
              volumes:
                  - id: data
                    dir: /var/lib/postgresql/data
              instructions:
                  - title: Connection String
                    content: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
                  - title: PostgreSQL Connect Command
                    content: psql "postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
                  - title: PostgreSQL username
                    content: ${POSTGRES_USERNAME}
                  - title: PostgresSQL password
                    content: ${POSTGRES_PASSWORD}
                  - title: PostgresSQL database
                    content: ${POSTGRES_DATABASE}
                  - title: PostgreSQL host
                    content: ${PORT_FORWARDED_HOSTNAME}
                  - title: PostgreSQL port
                    content: ${DATABASE_PORT_FORWARDED_PORT}
              env:
                  N8N-MAIN_PASSWORD:
                      default: "****"
                      expose: false
                  N8N-WORKER_PASSWORD:
                      default: "****"
                      expose: false
                  N8N_MAIN_HOST:
                      default: "****"
                      expose: false
                  N8N_WORKER_HOST:
                      default: "****"
                      expose: false
                  PGDATA:
                      default: /var/lib/postgresql/data/pgdata
                      expose: false
                  POSTGRES_CONNECTION_STRING:
                      default: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                      expose: false
                  POSTGRES_DATABASE:
                      default: ${POSTGRES_DB}
                      expose: true
                  POSTGRES_DB:
                      default: zeabur
                      expose: true
                  POSTGRES_HOST:
                      default: ${CONTAINER_HOSTNAME}
                      expose: true
                  POSTGRES_PASSWORD:
                      default: ${PASSWORD}
                      expose: true
                  POSTGRES_PORT:
                      default: ${DATABASE_PORT}
                      expose: true
                  POSTGRES_URI:
                      default: ${POSTGRES_CONNECTION_STRING}
                      expose: true
                  POSTGRES_USER:
                      default: root
                      expose: false
                  POSTGRES_USERNAME:
                      default: ${POSTGRES_USER}
                      expose: true
                  PUBLIC_DOMAIN:
                      default: "****"
                      expose: false
                  REDIS_HOST:
                      default: "****"
                      expose: false
                  REDIS_PASSWORD:
                      default: "****"
                      expose: false
              configs:
                  - path: /etc/postgresql/postgresql.conf
                    template: |
                        # https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
                        listen_addresses = '*'
                        max_connections = 100
                        shared_buffers = 128MB
                        dynamic_shared_memory_type = posix
                        max_wal_size = 1GB
                        min_wal_size = 80MB
                        log_timezone = 'Etc/UTC'
                        datestyle = 'iso, mdy'
                        timezone = 'Etc/UTC'
                        lc_messages = 'en_US.utf8'
                        lc_monetary = 'en_US.utf8'
                        lc_numeric = 'en_US.utf8'
                        lc_time = 'en_US.utf8'
                        default_text_search_config = 'pg_catalog.english'
                    permission: null
                    envsubst: null
              portForwarding:
                  enabled: true
        - name: n8n-runner
          icon: https://cdn.zeabur.com/prebuilt.svg
          template: PREBUILT_V2
          spec:
              source:
                  image: n8nio/runners:latest
              env:
                  N8N_RUNNERS_AUTH_TOKEN:
                      default: "****"
                      expose: false
                  N8N_RUNNERS_BROKER_HOST:
                      default: "****"
                      expose: false
                  N8N_RUNNERS_BROKER_PORT:
                      default: "5679"
                      expose: false
                  N8N_RUNNERS_TASK_BROKER_URI:
                      default: "****"
                      expose: false
              configs: []

Any help? :folded_hands:

1 Like

# … (lines above)

    - name: n8n-runner

      icon: https://cdn.zeabur.com/prebuilt.svg

      template: PREBUILT_V2

      spec:

          source:

              image: n8nio/runners:latest

          env:

              N8N_RUNNERS_AUTH_TOKEN:

                  default: "\*\*\*\*"

                  expose: false

              N8N_RUNNERS_BROKER_HOST:

                  default: n8n-main  # <--- CHANGED

                  expose: false

              N8N_RUNNERS_BROKER_PORT:

                  default: "5679"

                  expose: false

              N8N_RUNNERS_TASK_BROKER_URI:

                  default: ws://n8n-main:5679  # <--- CHANGED/ADDED EXPLICITLY

                  expose: false

          configs: \[\]

Hey @James7 !

I think you need togive the runner the correct address (the internal Zeabur service name) to cornnect bacck to the maneger, allowing the Python jobs to be reconized and queueed.

Hope it fix tour issue.

Cheers!