You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble compiling a simple query to Postgres inside Docker on macOS. The following compiles fine natively but hangs indefinitely when run with docker-compose together with a Postgres instance.
When I use the query! macro I get Connection reset from Postgres, when using sqlx::query there is no query to Postgres but the compilation hangs in the same way.
#[tokio::main]asyncfnmain() -> Result<(), sqlx::Error>{let database_url = std::env::var("DATABASE_URL").unwrap();let db_pool = sqlx::postgres::PgPoolOptions::new().max_connections(1).connect(&database_url).await?;let result = sqlx::query!("SELECT id FROM test").fetch_all(&db_pool).await?;println!("result: {:?}", result);Ok(())}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm having trouble compiling a simple query to Postgres inside Docker on macOS. The following compiles fine natively but hangs indefinitely when run with
docker-compose
together with a Postgres instance.When I use the
query!
macro I getConnection reset
from Postgres, when usingsqlx::query
there is no query to Postgres but the compilation hangs in the same way.What am I doing wrong? 🙏 Reproduction repo: https://github.com/kessl/sqlx-compile-hangs
Local Rust version:
1.53
Docker build image:
rust:1.53-slim
Docker on macOS version:
20.10.7
Beta Was this translation helpful? Give feedback.
All reactions