ClickHouse / clickhouse-js

Official JS client for ClickHouse DB
https://clickhouse.com
Apache License 2.0
205 stars 25 forks source link

Getting "Error: Cannot modify 'enable_http_compression' setting in readonly mode." #221

Closed 0xStrobe closed 8 months ago

0xStrobe commented 8 months ago

I have a readonly user which I want to use this client library to connect with. I'm getting this error on any requests sent, and I'm not so sure how to move forward.

I tried creating the clickhouse client objects with enable_http_compression set to both 1 or 0. However it still throws that error.

const client = createClient({
    host: process.env.CLICKHOUSE_HOST,
    username: process.env.CLICKHOUSE_USERNAME,
    password: process.env.CLICKHOUSE_PASSWORD,
    clickhouse_settings: {
      enable_http_compression: 1, // 0 doesn't work either
    },
  }),

My enable_http_compression setting in Clickhouse is 0.

How can I fix this and connect to my DB using a readonly user?

Additionally, slightly out of scope - how to change this setting on the db side? The docs are a little vague - I'm aware that this setting is a part of the http interface, but it's unclear to me if and how I could change it in the XML file. Which section of this setting belongs to? I tried to change it via SQL commands SET enable_http_compression=1;, but there seems to be no effects.

slvrtrn commented 7 months ago

Just noticed this issue (I didn't get a notification for a closed one for some reason). I've recently added a runnable read-only user example which might help if it is still an issue.