-
Notifications
You must be signed in to change notification settings - Fork 23
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
Extra help when config incorrect #1187
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love these changes!
seconds if seconds < 1 => format!("{}ms", wait.as_millis()), | ||
seconds => format!("{seconds}s") | ||
}; | ||
format!("Connecting to {desc} (will try up to {wait_msg})...\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this telling me the number of retries or the time? I assume it's the time since wait_msg
is set to wait.as_secs()
, but it's not entirely clear based on the message. I.e., is the next word "times" or "seconds?"
Maybe wait_msg
includes "seconds," and if so, ignore this suggestion.
format!("Connecting to {desc} (will try up to {wait_msg})...\n") | |
format!("Connecting to {desc} (will try for up to {wait_msg} seconds)...\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it'll be seconds or milliseconds (though far more likely to be seconds), written s or ms (ms if under one second). Could change s to seconds though.
Interestingly during the 30 seconds you can see it trying over and over again if you set the RUST_LOG to something like debug so we could technically put those messages in if it makes sense. It's noisier but the advantage would be that the user gets to see the problem within five seconds instead of twiddling thumbs until the 30 seconds have passed / killing the process.
Here's the output with debug, could pull out those debug messages and print them a bit nicer:
PS C:\rust\edgedb-cli> cargo run
Finished dev [optimized + debuginfo] target(s) in 0.45s
Running `target\debug\edgedb.exe`
[2023-12-12T13:58:31Z DEBUG edgedb::version_check] Cached version None
[2023-12-12T13:58:31Z INFO edgedb_tokio::raw::connection] Connecting via TCP localhost:10757
[2023-12-12T13:58:31Z DEBUG rustyline] PathInfo("C:\\Users\\mithr\\AppData\\Local\\edgedb\\edgeql.history", SystemTime { intervals: 133468273415897816 }, 100)
Connecting to EdgeDB instance 'edgedb_cli' at localhost:10757 (will try up to 30s)...
[2023-12-12T13:58:35Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
[2023-12-12T13:58:39Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
[2023-12-12T13:58:43Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
[2023-12-12T13:58:47Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
[2023-12-12T13:58:51Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
[2023-12-12T13:58:56Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
[2023-12-12T13:59:00Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
[2023-12-12T13:59:04Z DEBUG edgedb_tokio::raw::connection] Temporary connection error: ClientConnectionError: No connection could be made because the target machine actively refused it. (os error 10061)
edgedb error: ClientConnectionFailedError: cannot establish connection for 30s: No connection could be made because the target machine actively refused it. (os error 10061)
error: process didn't exit successfully: `target\debug\edgedb.exe` (exit code: 1)```
Resolves #1125 plus adds some extra help when database fails to connect.
(Redoing another PR that also went after the ._is_interactive() part which I see is recently added code)
In case of:
user
,password
, ordatabase
: adds hint to useedgedb info
to find config file locationSome before and afters:
Incorrect port
Connecting to EdgeDB instance 'anything' at localhost:11700...edgedb error: ClientConnectionFailedError: cannot establish connection for 30s: No connection could be made because the target machine actively refused it. (os error 10061)
Connecting to EdgeDB instance 'anything' at localhost:11700 (will try up to 30s)...
edgedb error: ClientConnectionFailedError: cannot establish connection for 30s: No connection could be made because the target machine actively refused it. (os error 10061)
Incorrect user
Connecting to EdgeDB instance 'anything' at localhost:10700...edgedb error: AuthenticationError: authentication failed
Server traceback:
Traceback (most recent call last):
File "edb/server/protocol/frontend.pyx", line 338, in edb.server.protocol.frontend.FrontendConnection.main
File "edb/server/protocol/binary.pyx", line 951, in authenticate
File "edb/server/protocol/binary.pyx", line 285, in auth
File "edb/server/protocol/frontend.pyx", line 574, in _authenticate
File "edb/server/protocol/frontend.pyx", line 690, in _auth_scram
edb.errors.AuthenticationError: authentication failed
Connecting to EdgeDB instance 'anything' at localhost:10700 (will try up to 30s)...
Failed to authenticate.
Hint: Use
edgedb info
to find and check the config for this instanceedgedb error: AuthenticationError: authentication failed
Server traceback:
Traceback (most recent call last):
File "edb/server/protocol/frontend.pyx", line 338, in edb.server.protocol.frontend.FrontendConnection.main
File "edb/server/protocol/binary.pyx", line 951, in authenticate
File "edb/server/protocol/binary.pyx", line 285, in auth
File "edb/server/protocol/frontend.pyx", line 574, in _authenticate
File "edb/server/protocol/frontend.pyx", line 690, in _auth_scram
edb.errors.AuthenticationError: authentication failed
Incorrect password
Connecting to EdgeDB instance 'anything' at localhost:10700...edgedb error: AuthenticationError: authentication failed
Server traceback:
Traceback (most recent call last):
File "edb/server/protocol/frontend.pyx", line 338, in edb.server.protocol.frontend.FrontendConnection.main
File "edb/server/protocol/binary.pyx", line 951, in authenticate
File "edb/server/protocol/binary.pyx", line 285, in auth
File "edb/server/protocol/frontend.pyx", line 574, in _authenticate
File "edb/server/protocol/frontend.pyx", line 690, in _auth_scram
edb.errors.AuthenticationError: authentication failed
Connecting to EdgeDB instance 'anything' at localhost:10700 (will try up to 30s)...
Failed to authenticate.
Hint: Use
edgedb info
to find and check the config for this instanceedgedb error: AuthenticationError: authentication failed
Server traceback:
Traceback (most recent call last):
File "edb/server/protocol/frontend.pyx", line 338, in edb.server.protocol.frontend.FrontendConnection.main
File "edb/server/protocol/binary.pyx", line 951, in authenticate
File "edb/server/protocol/binary.pyx", line 285, in auth
File "edb/server/protocol/frontend.pyx", line 574, in _authenticate
File "edb/server/protocol/frontend.pyx", line 690, in _auth_scram
edb.errors.AuthenticationError: authentication failed
Incorrect database
Connecting to EdgeDB instance 'anything' at localhost:10700...[2023-12-12T02:59:31Z WARN edgedb_tokio::raw::connection] Error received from server: database 'edgedbb' does not exist. Severity: Error. Code: 0x4030005
edgedb error: ClientConnectionFailedError: end of stream while reading message
Connecting to EdgeDB instance 'anything' at localhost:10700 (will try up to 30s)...
[2023-12-12T02:59:56Z WARN edgedb_tokio::raw::connection] Error received from server: database 'edgedbb' does not exist. Severity: Error. Code: 0x4030005
edgedb error: ClientConnectionFailedError: end of stream while reading message
Incorrect tls_cert_data
edgedb error: ClientError: cannot read credentials file C:\Users\mithr\AppData\Local\EdgeDB\config\credentials\anything.json: detected conflicting settings: tls_ca=Some("-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgIRANoFby9jWEKWg+rIfBNbHxIwDQYJKoZIhvcNAQELBQAw\nGDEWMBQGA1UEAwwNRWRnZURCIFNlcnZlcjAeFw0yMzEyMDYyMTQxMjRaFw00MzAy\nMDUyMTQxMjRaMBgxFjAUBgNVBAMMDUVkZ2VEQiBTZXJ2ZXIwggEiMA0GCSqGSIb3\nDQEBAQUAA4IBDwAwggEKAoIBAQDqPb0sq6MVF4KCnrNisfzpSuigE8qd0vTIUqdj\ntsgyA534V/8jVCSlsy+LNDwEbwC8ChbuhyP65HgTmsdiiMkXHR3/E0g8POqLcm40\n24oTBqtRc4f8SOHHJThcxeLZ2WzgdvEjTJGhet/fR/8Gv4Fz8tClbqISfMkqHOVE\n5ViDKAtlpiGfDxfIrTBlHhuZM3BnD7o9yi+3zh7+aTHPVnbs2lxhh9O/Caa8TCUW\nsFocrEEijQRoIVmk3nzJ8goRZyIIBAY9g/OB06yW9LNGBbvHhNZyeKNQ7nnL8LMJ\nJ2Bpgbibp2itwFGZtrc1mnAnVNvx8CROnSpcQYTnh2AUEei9AgMBAAGjGDAWMBQG\nA1UdEQQNMAuC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WxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOCAQEAELhVm4yRpvvG\nK0kyLsSSMZDwSXGbm4MiCFpRktJ04vo7o2j2OPwqxtjgNhmi7Xb8TUshD4dOWqU5\nrSzcGAtnqfCiLu6kqA9k2vfGSn/WiQb0ItpcqtyNQ3QqwOXju7wiTxGqjudhINuf\nXzSqZkBfpdAzpXG1e/PlKAepQ80Q9nP3j7dtmA3KbWDuJ+I1b4oOBNzhQZbXjsxH\n8uuY51TmnupI6TPu+KqVfln1Km5HlPeIKMrdoO0HVaU86+bBx+k0N0in1spOUCbz\nHdk0zWy2iYye2sMhtnsLDJysyIDOHEYTMoQ2XakuSiSOZmJvlCCFdrLF5jml5Ab8\nU9Q49+cuzQ==\n-----END CERTIFICATE-----\n")
edgedb error: ClientError: cannot read credentials file C:\Users\mithr\AppData\Local\EdgeDB\config\credentials\anything.json: detected conflicting settings.
tls_ca =
Some(
"-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgIRANoFby9jWEKWg+rIfBNbHxIwDQYJKoZIhvcNAQELBQAw\nGDEWMBQGA1UEAwwNRWRnZURCIFNlcnZlcjAeFw0yMzEyMDYyMTQxMjRaFw00MzAy\nMDUyMTQxMjRaMBgxFjAUBgNVBAMMDUVkZ2VEQiBTZXJ2ZXIwggEiMA0GCSqGSIb3\nDQEBAQUAA4IBDwAwggEKAoIBAQDqPb0sq6MVF4KCnrNisfzpSuigE8qd0vTIUqdj\ntsgyA534V/8jVCSlsy+LNDwEbwC8ChbuhyP65HgTmsdiiMkXHR3/E0g8POqLcm40\n24oTBqtRc4f8SOHHJThcxeLZ2WzgdvEjTJGhet/fR/8Gv4Fz8tClbqISfMkqHOVE\n5ViDKAtlpiGfDxfIrTBlHhuZM3BnD7o9yi+3zh7+aTHPVnbs2lxhh9O/Caa8TCUW\nsFocrEEijQRoIVmk3nzJ8goRZyIIBAY9g/OB06yW9LNGBbvHhNZyeKNQ7nnL8LMJ\nJ2Bpgbibp2itwF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