From 331b5f188a13cf2609d59ab9c30a62013481cbe5 Mon Sep 17 00:00:00 2001 From: Mike Moran Date: Mon, 8 Jan 2024 20:10:59 +0000 Subject: [PATCH] switch to supavisor (however, has bugs) - when running a query, I get: ``` ...webapp::router: search failed: error returned from database: prepared statement "sqlx_s_2" does not exist ``` - this looks similar to this issue: https://github.com/supabase/supavisor/issues/239 (just opened a couple of weeks ago) --- backend/shared/src/queryable.rs | 5 +++-- backend/webapp/src/router.rs | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/shared/src/queryable.rs b/backend/shared/src/queryable.rs index 8df9334..cffc48c 100644 --- a/backend/shared/src/queryable.rs +++ b/backend/shared/src/queryable.rs @@ -40,6 +40,7 @@ const BASE_URL_STRING: &str = "https://fosdem.org/2024/schedule/event/"; const MAX_POOL_CONNECTIONS: u32 = 10; const MAX_RELATED_EVENTS: u8 = 5; +const DB_REGION: &str = "eu-central-1"; impl Queryable { pub async fn connect( @@ -52,8 +53,8 @@ impl Queryable { debug!("Connecting to DB"); let db_url = format!( - "postgres://postgres:{}@db.{}.supabase.co/postgres", - db_password, db_id + "postgres://postgres.{}:{}@aws-0-{}.pooler.supabase.com:6543/postgres", + db_id, db_password, DB_REGION ); let pool = PgPoolOptions::new() .max_connections(MAX_POOL_CONNECTIONS) diff --git a/backend/webapp/src/router.rs b/backend/webapp/src/router.rs index d736ba7..0cb46d6 100644 --- a/backend/webapp/src/router.rs +++ b/backend/webapp/src/router.rs @@ -15,7 +15,7 @@ use tower_http::{ cors::{Any, CorsLayer}, services::ServeDir, }; -use tracing::info; +use tracing::{error, info}; use validator::Validate; use crate::related::related; @@ -80,7 +80,10 @@ async fn search( let html = page.render().unwrap(); Ok(Html(html)) } - Err(_) => Err("search failed".into()), + Err(e) => { + error!("search failed: {}", e); + Err("search failed".into()) + } } }