Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with sslCA driverOption #40

Closed
wants to merge 1 commit into from

Conversation

edvardpotter
Copy link

When I set sslCA in driverOptions like this:

clickhouse:
                host:     '%host%'
                port:     '%port%'
                user:     '%username%'
                password: '%password%'
                dbname:   '%name%'
                driver_class: FOD\DBALClickHouse\Driver
                wrapper_class: FOD\DBALClickHouse\Connection
                options:
                    enable_http_compression: 1
                    max_execution_time: 60
                    sslCA: '/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt'
                    https: true

I get the next error (Unknown setting sslCA):

bin/console doctrine:migrations:migrate --em=clickhouse --configuration=./app/config/migrations/doctrine_migrations_clickhouse.yml --no-interaction                                                 
Loading configuration from command option: ./app/config/migrations/doctrine_migrations_clickhouse.yml
                                                              
                    Application Migrations                    
                                                              
23:19:31 ERROR     [console] Error thrown while running command "doctrine:migrations:migrate --em=clickhouse --configuration='./app/config/migrations/doctrine_migrations_clickhouse.yml' --no-interaction". Message: "An exception occurred while executing 'SELECT database, name FROM system.tables WHERE database != 'system' AND engine != 'View'':

Unknown setting sslCA 
IN:SELECT database, name FROM system.tables WHERE database != 'system' AND engine != 'View' FORMAT JSON" ["exception" => Doctrine\DBAL\DBALException { …},"command" => "doctrine:migrations:migrate --em=clickhouse --configuration='./app/config/migrations/doctrine_migrations_clickhouse.yml' --no-interaction","message" => """  An exception occurred while executing 'SELECT database, name FROM system.tables WHERE database != 'system' AND engine != 'View'':\n  \n  Unknown setting sslCA \n  IN:SELECT database, name FROM system.tables WHERE database != 'system' AND engine != 'View' FORMAT JSON  """]

In DBALException.php line 172:
                                                                                                                                     
  An exception occurred while executing 'SELECT database, name FROM system.tables WHERE database != 'system' AND engine != 'View'':  
                                                                                                                                     
  Unknown setting sslCA                                                                                                              
  IN:SELECT database, name FROM system.tables WHERE database != 'system' AND engine != 'View' FORMAT JSON

This happen because sslCA passed in URI

https://somecluster.yandex.net:8443?extremes=0&readonly=2&max_execution_time=60&enable_http_compression=1&database=db1&sslCA=%2Fusr%2Flocal%2Fshare%2Fca-certificates%2FYandex%2FYandexInternalRootCA.crt

and clickhouse return this error:

Code: 115, e.displayText() = DB::Exception: Unknown setting sslCA (version 20.12.3.3 (official build))

Also for this parameter to work, it must be passed in \ClickHouseDB\Client::__construct(connectParams)

(currently it passed in \ClickHouseDB\Client::__construct(settings)).

I fixed this issues in my fork.

@asanikovich
Copy link
Member

Fixed in #71

@edvardpotter
Copy link
Author

So fast, thanks 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants