Skip to content
© 2026 The ThingsBoard Authors
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

JS Executor Configuration

TB_QUEUE_TYPE · Default kafka

Queue type used for JS evaluation requests: kafka or in-memory

TB_QUEUE_PREFIX

Optional prefix applied to all queue/topic names; useful for environment isolation

REMOTE_JS_EVAL_REQUEST_TOPIC · Default js_eval.requests

Kafka topic name for incoming JS evaluation requests

HTTP_PORT · Default 8888

HTTP port exposing the /livenessProbe health check endpoint

REMOTE_JS_RESPONSE_POLL_INTERVAL_MS · Default 25

Interval in milliseconds to poll for JS execution responses

JS_MAX_RESULT_SIZE · Default 300000

Maximum allowed size in bytes of a JS execution result

TB_KAFKA_SERVERS · Default localhost:9092

Kafka Bootstrap Servers

TB_QUEUE_KAFKA_REPLICATION_FACTOR · Default 1

Number of replicas for each Kafka topic partition

TB_KAFKA_ACKS · Default 1

-1 = all; 0 = no acknowledgments; 1 = only waits for the leader to acknowledge

TB_KAFKA_BATCH_SIZE · Default 128

Maximum number of messages to accumulate before triggering a batch send

TB_KAFKA_LINGER_MS · Default 5

Time in milliseconds the producer waits before sending a batch, allowing more messages to accumulate

TB_KAFKA_PARTITIONS_CONSUMED_CONCURRENTLY · Default 1

(EXPERIMENTAL) increase this value if you are planning to handle more than one partition (scale up, scale down) - this will decrease the latency

TB_QUEUE_KAFKA_REQUEST_TIMEOUT_MS · Default 30000

Time in milliseconds to wait for a response to a Kafka request before timing out

TB_KAFKA_CONNECTION_TIMEOUT_MS · Default 1000

Time in milliseconds to wait when establishing a connection to a Kafka broker

TB_QUEUE_KAFKA_COMPRESSION · Default none

Message compression codec for the producer: gzip, lz4 or none

TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES · Default retention.ms:604800000;segment.bytes:52428800;retention.bytes:104857600;partitions:100;min.insync.replicas:1

Semicolon-separated Kafka topic configuration properties applied on topic creation

TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD · Default false

Set to true to enable Confluent Cloud-specific configuration (SSL + SASL)

KAFKA_CLIENT_ID · Default kafkajs

Kafka client identifier; inject the pod name to easily identify the client via kafka-consumer-groups.sh

TB_KAFKA_SSL_ENABLED · Default false

Enable SSL/TLS for Kafka broker connections

TB_KAFKA_SSL_PEM_CERTIFICATE

TB_KAFKA_SSL_PEM_KEY

TB_KAFKA_SSL_PEM_KEY_PASSWORD

TB_KAFKA_SSL_PEM_TRUSTS_CERTIFICATE

TB_QUEUE_KAFKA_CONFLUENT_SASL_MECHANISM · Default PLAIN

SASL mechanism for Confluent Cloud authentication: PLAIN, SCRAM-SHA-256, or SCRAM-SHA-512

TB_QUEUE_KAFKA_CONFLUENT_USERNAME

TB_QUEUE_KAFKA_CONFLUENT_PASSWORD

LOGGER_LEVEL · Default info

Log level: trace, debug, info, warn, or error

LOG_FOLDER · Default logs

Directory path where log files are written

LOGGER_FILENAME · Default tb-js-executor-%DATE%.log

Log file name pattern; %DATE% is replaced with the current date

JavaScript execution and monitoring configuration

Section titled “JavaScript execution and monitoring configuration”

SCRIPT_USE_SANDBOX · Default true

WARNING: setting this to “false” is DANGEROUS BY DESIGN. The non-sandbox path compiles and runs user-supplied scripts in the host realm via vm.compileFunction; it provides no isolation and exposes the host process (file system, environment variables, child_process, etc.) to script authors. Use “false” only as a performance trade-off in trusted, non-public clusters where every script author is fully trusted.

MEMORY_USAGE_TRACE_FREQUENCY · Default 1000

Log memory usage every N script executions

SCRIPT_STAT_PRINT_FREQUENCY · Default 10000

Print execution statistics every N script executions

SCRIPT_BODY_TRACE_FREQUENCY · Default 10000

Log the script body every N script executions

MAX_ACTIVE_SCRIPTS · Default 1000

Maximum number of compiled scripts kept in the cache

SLOW_QUERY_LOG_MS · Default 5.000000

Execution time threshold in milliseconds above which a script is considered slow and logged

SLOW_QUERY_LOG_BODY · Default false

Log the script body when execution time exceeds slow_query_log_ms threshold

NODE_OPTIONS

Standard Node.js environment variable for passing CLI flags to the runtime process. The following flags are recommended best practices for production deployments:

  • --max-old-space-size=200 — caps the V8 old-generation heap at 200 MB. Increase this value based on your workload needs. For containerized deployments, set the container memory limit at least 100 MB above this value — Node.js requires additional memory beyond the heap limit for runtime internals, and a tight limit causes OOM evictions.
  • --permission — activates Node.js’s built-in Permission Model (available since Node.js 20), which denies all privileged operations by default and requires explicit allow-flags for each capability. Recommended for publicly available deployments.
  • --allow-fs-read=/usr/share/tb-js-executor/* — grants read-only filesystem access exclusively to the executor’s own installation directory, blocking any attempt by a script to read arbitrary files on the host. Required when --permission is set.