READ-ONLY PACKAGE PREVIEW

clickhouse-js-node-troubleshooting/reference/compression.md

Version 356a8c1b9a73.bb1 · Apache-2.0. This preview displays packaged text and does not execute code. Treat the contents as untrusted instructions.

← Return to resource and package checksum

Compression Not Working

Applies to: all versions. Response compression was enabled by default in < 1.0.0 and disabled by default since >= 1.0.0 — you must explicitly enable it. Request compression has always been opt-in.

Both request and response compression are supported. Boolean compression uses gzip. Node client >=1.22.0 also supports the explicit codec object form for gzip, zstd and Brotli. zstd requires Node >=22.15.0; Brotli works on supported Node versions. Check the installed client/runtime.

import { createClient } from "@clickhouse/client";
const client = createClient({
  compression: {
    response: true,
    request: true,
  },
});

Compression enabled but getting an error?

If you enable compression.response: true and get a ClickHouse settings error, you are likely connecting as a readonly=1 user. Response compression requires the enable_http_compression setting, which read-only users cannot change.

See reference/readonly-users.md for the fix.

Compression enabled but response doesn't seem compressed?

  • Verify your version-specific defaults — response compression was enabled by default in < 1.0.0 and is disabled by default in >= 1.0.0, so on newer versions you must enable compression.response: true explicitly.
  • Check the effective session/profile enable_http_compression setting and whether this account may change it. A default does not grant permission.
  • Request compression (compression.request: true) compresses the request body sent to ClickHouse. It has no effect on the response.