trilogy-libraries / activerecord-trilogy-adapter

Active Record adapter for the Trilogy database client for Rails v6.0 - v7.0.
https://github.com/trilogy-libraries/trilogy
MIT License
172 stars 17 forks source link

verify_ca not working #74

Closed mohamedhafez closed 1 month ago

mohamedhafez commented 1 month ago

In my Rails 6.1 application, I have

ssl_mode: verify_ca
sslca: /opt/homebrew/var/mysql/ca.pem

It works with the mysql2 adapter, but when i try to switch to trilogy I get the following error when trying to make a request of the database:

/Users/mohamed/.rbenv/versions/truffleruby+graalvm-24.1.0/lib/gems/gems/activerecord-trilogy-adapter-3.1.2/lib/active_record/connection_adapters/trilogy_adapter.rb:84:in `new_client': trilogy_ssl_upgrade: SSL Error: certificate verify failed (ActiveRecord::ConnectionNotEstablished)

Does Trilogy not support verify_ca? (it works just fine once I switch to ssl_mode: required)

mohamedhafez commented 1 month ago

(I wasn't sure where the correct place to file this bug was, there's a duplicate at: https://github.com/trilogy-libraries/trilogy/issues/202, feel free to close the one that's in the wrong place)

mohamedhafez commented 1 month ago

Same error occurs under Rails 7.0.8.4, Ruby 3.3.5, activerecord-trilogy-adapter 3.1.2, trilogy 2.8.1:

trilogytest $ bin/rails db:migrate
bin/rails aborted!
ActiveRecord::ConnectionNotEstablished: trilogy_ssl_upgrade: SSL Error: certificate verify failed (ActiveRecord::ConnectionNotEstablished)

(works just fine with the mysql2 gem)

mohamedhafez commented 1 month ago

Closing as this was delt with in https://github.com/trilogy-libraries/trilogy/issues/202