-
Notifications
You must be signed in to change notification settings - Fork 36
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
Unable to connect to RDS Proxy #201
Comments
Hey @Octogonapus, thanks for opening an issue. The main difference I see is that you're setting So I opened this PR that should allow you to do so. In your case, you'd do something like: DBInterface.connect(....; ssl_mode=MySQL.API.SSL_MODE_VERIFY_IDENTITY) Could you try that out and see if it works for you? To try out my PR, you can do the following from the REPL: ] add MySQL#jq/ssl_mode Then reload your session and do |
Using that option gives me this error: ┌ Error: Failed to connect to the proxy endpoint
--
│ exception =
│ (2054): This feature is not implemented or disabled
│ Stacktrace:
│ [1] setoption(mysql::MySQL.API.MYSQL, option::MySQL.API.mysql_option, arg::MySQL.API.mysql_ssl_mode)
│ @ MySQL.API ~/.julia/packages/MySQL/O5YSd/src/api/capi.jl:4
│ [2] #setoptions!#4
│ @ ~/.julia/packages/MySQL/O5YSd/src/MySQL.jl:204 [inlined]
│ [3] MySQL.Connection(host::String, user::String, passwd::SubString{String}, db::String, port::Int64, unix_socket::String; kw::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:ssl_ca, :ssl_verify_server_cert, :ssl_enforce, :ssl_mode), Tuple{String, Bool, Bool, MySQL.API.mysql_ssl_mode}}})
│ @ MySQL ~/.julia/packages/MySQL/O5YSd/src/MySQL.jl:29
│ [4] #connect#5
│ @ ~/.julia/packages/MySQL/O5YSd/src/MySQL.jl:292 [inlined]
│ [5] main()
│ @ Main /runtime/debug_db.jl:58
│ [6] top-level scope
│ @ /runtime/debug_db.jl:80
│ [7] include(mod::Module, _path::String)
│ @ Base ./Base.jl:419
│ [8] exec_options(opts::Base.JLOptions)
│ @ Base ./client.jl:303
│ [9] _start()
│ @ Base ./client.jl:522
└ @ Main /runtime/debug_db.jl:76 Using this code: conn = DBInterface.connect(
MySQL.Connection,
ENV["PROXY_ENDPOINT"],
ENV["DB_USERNAME"],
db_auth_token;
unix_socket="",
port=parse(Int, string(ENV["DB_PORT"])),
ssl_ca="/runtime/AmazonRootCA1.pem",
ssl_verify_server_cert=true,
ssl_enforce=true,
ssl_mode=MySQL.API.SSL_MODE_VERIFY_IDENTITY
) (I think that PR is still useful nonetheless) |
In the RDS proxy logs I am seeing this:
Maybe there is a problem with how the DB auth token is handled? The token is of the form |
It looks like this is my fault, though I don't yet understand how. The problem appears to be with the token. Hard-coding a token into my Julia script works, so the problem can't be with MySQL.jl. Thanks for your help anyway. You are welcome to close this issue if you want, but that PR you opened is still useful to me because I would use |
I did a little more research and it turns out that the MariaDB Connector C, that we're using under the hood, doesn't support the SSL_MODE thing in my PR anyway, since it's a MySQL Connector-only thing. So you're saying if you hardcode the token in your script, even the proxy endpoint works with MySQL.jl? |
Indeed, MySQL.jl is not what was causing the issue.
So for MariaDB, setting |
Yeah, that's what I understand looking at their source code. Yeah, sorry to not be more helpful here; database creds stuff can be gnarly, especially when you're dealing w/ proxies and cloud stuff. |
…to ccall Proper fix to #201. The core issue here is that if you take the `pointer` of a SubString, it doesn't properly account for the _substring_ length, because C strings continue until the NUL termination.
This is more of a question than a bug report. I'm not sure if the problem is in my code or not.
I'm trying to connect to an RDS MySQL DB via RDS Proxy and I'm unable to do so via MySQL.jl. Using the
mysql
CLI works fine. This shell code runs fine (connects and runs the SQL code):So in summary, the
mysql
CLI can connect to both the DB endpoint and proxy endpoint just fine.Here's my code to connect to the DB endpoint via MySQL.jl:
with_connection
passes all arguments toconnect
so for this example, they are the same.As expected, this works fine.
Here's my code to connect to the proxy endpoint via MySQL.jl:
AFAICT this should have the same behavior as the
mysql
CLI code.However, this does not work; I get this error back:
Do you see anything wrong with my Julia code to open the connection to the proxy endpoint?
Julia v1.8.2. MySQL.jl v1.4.2.
The text was updated successfully, but these errors were encountered: