Skip to content

Commit

Permalink
switch to supavisor (however, has bugs)
Browse files Browse the repository at this point in the history
- 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: supabase/supavisor#239 (just opened a couple of weeks ago)
  • Loading branch information
mikemoraned committed Jan 8, 2024
1 parent aeeccd5 commit 331b5f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions backend/shared/src/queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions backend/webapp/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
}
}
}

Expand Down

0 comments on commit 331b5f1

Please sign in to comment.