- Notifications
You must be signed in to change notification settings - Fork514
Closed
Description
My first try with this library and although I can establish a connection with the DB running a query always locks up my lambda until the 10 minute timer runs out.
Last output is "query sent", client.is_closed() returns false, making the user/pw wrong results in a connection error instead as expected.
I tried different queries and different functions (query_one, query_raw, etc.).
The code runs in a AWS lambda and connects to a serverless Aurora Postgresql DB inside a VPC.
Is there any additional debugging I can do to find the root cause?
src/main.rs
let cert = fs::read("global-bundle.pem")?;println!("file read");let cert = Certificate::from_pem(&cert)?;println!("cert created");let connector = TlsConnector::builder().add_root_certificate(cert).build()?;println!("connector built");let connector = MakeTlsConnector::new(connector);println!("connector created");let connect_result = tokio_postgres::connect("host=#####.us-west-2.rds.amazonaws.com port=5432 user=### password=### dbname=### connect_timeout=10",connector,).await;println!("connection finished");if connect_result.is_err() {let error_msg = connect_result.err().unwrap().to_string();println!("Error: {}", error_msg);return Ok(json!({ "error": error_msg }))}let (client, _connection) = connect_result.unwrap();println!("connection unwrapped");println!("Client closed: {}", client.is_closed());let db_response = client.query_one("SELECT name FROM workspaces WHERE id = 760", &[]);println!("query sent");let db_response = db_response.await;println!("query finished");
Cargo.toml
[package]name = "test"version = "0.1.0"edition = "2021"autobins = false[dependencies]lambda_http = "*"lambda_runtime = "*"graphql_client = "*"env_logger = "*"serde = "*"serde_json = "*"ndarray = "*"tokio = { version = "1", features = ["macros"] }tracing = { version = "0.1", features = ["log"] }tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }tokio-postgres = "*"postgres-native-tls = "*"native-tls = "*"openssl = { version = "0.10", features = ["vendored"] }futures = "*"[[bin]]name = "bootstrap"path = "src/main.rs"[profile.release]strip = true
Metadata
Metadata
Assignees
Labels
No labels