cube-js/cube · error

CUBEJS_ENABLE_TLS has been deprecated and removed.

Error message

CUBEJS_ENABLE_TLS has been deprecated and removed.

What it means

TLS support via the CUBEJS_ENABLE_TLS environment variable was deprecated and removed from Cube Server. During listen(), if getEnv('tls') resolves truthy, Cube throws immediately rather than attempting a TLS listen it no longer supports. TLS must now be terminated externally (reverse proxy/load balancer) or via other means.

Source

Thrown at packages/cubejs-server/src/server.ts:106

  public async listen(options: http.ServerOptions = {}): Promise<{app: Express, port: number, server: GracefulHttpServer, version: any }> {
    try {
      if (this.server) {
        throw new Error('CubeServer is already listening');
      }

      const app = express();
      app.use(cors(this.config.http.cors));
      app.use(bodyParser.json({ limit: getEnv('maxRequestSize') }));

      if (this.config.gracefulShutdown) {
        app.use(gracefulMiddleware(this.status, this.config.gracefulShutdown));
      }

      await this.core.initApp(app);

      const enableTls = getEnv('tls');
      if (enableTls) {
        throw new Error('CUBEJS_ENABLE_TLS has been deprecated and removed.');
      }

      this.server = gracefulHttp(http.createServer(options, app));

      if (this.config.webSockets) {
        this.socketServer = new WebSocketServer(this.core, this.config);
        this.socketServer.initServer(this.server);
      }

      if (this.config.sqlPort || this.config.pgSqlPort) {
        this.sqlServer = this.core.initSQLServer();
        await this.sqlServer.init(this.config);
      }

      if (this.config.serverKeepAliveTimeout) {
        this.server.keepAliveTimeout = this.config.serverKeepAliveTimeout;
      }

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Remove the CUBEJS_ENABLE_TLS environment variable from the deployment environment
  2. Terminate TLS with a reverse proxy or load balancer (nginx, Traefik, ALB) in front of Cube
  3. Audit Docker/K8s env files and CI configs for leftover CUBEJS_ENABLE_TLS after upgrading
  4. Check Cube docs for the current recommended TLS/HTTPS setup

Example fix

// before (docker-compose env)
environment:
  - CUBEJS_ENABLE_TLS=true
// after
environment:
  - CUBEJS_API_PORT=4000
# terminate TLS at your proxy/load balancer instead
Defensive patterns

Strategy: validation

Validate before calling

if (process.env.CUBEJS_ENABLE_TLS) {
  throw new Error('CUBEJS_ENABLE_TLS is no longer supported; remove it and terminate TLS at your proxy');
}

Try / catch

try {
  await server.listen();
} catch (e) {
  if (e.message.includes('CUBEJS_ENABLE_TLS has been deprecated')) {
    console.error('Unset CUBEJS_ENABLE_TLS and terminate TLS externally');
  } else { throw e; }
}

Prevention

When it happens

Trigger: Starting CubeServer.listen() in an environment where CUBEJS_ENABLE_TLS is set (to 'true', '1', etc.), triggering the getEnv('tls') check right after initApp.

Common situations: Older deployments (Docker, Kubernetes manifests, docker-compose files) that still export CUBEJS_ENABLE_TLS; upgrade from an older Cube version where TLS-in-process was supported; copy-pasted env templates.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/54f08c00c6f5e466. Report an issue: GitHub.