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
What steps will reproduce the bug? (please provide code snippet if relevant)
pubasyncfninitialize_database<T:Runtime>(app:&AppHandle<T>){let uri = get_database_uri();ifletSome(db_path) = get_database_path(){let exists = std::fs::exists(&db_path).is_ok_and(|x| x);if !exists {let mkdir_res = std::fs::create_dir_all(&db_path);if mkdir_res.is_err(){error!("Creating the fluster managed database was unsuccessful.");println!("Creating the fluster managed database was unsuccessful.");}}let db_res = get_database().await;letmut db = db_res.lock().await;let db_exists = db.database_exists("fluster").await.is_ok_and(|x| x);if !exists || !db_exists {// This is only setup once when the application is initially launched.info!("Initializing database...");let setup_res = db.setup().await;if setup_res.is_err(){/// ----- Error occurs here ----print!("Error in db.setup - {:?}", setup_res.err());error!("An error occurred while attempting to initialize Fluster's database.");println!("An error occurred while attempting to initialize Fluster's database.");}info!("Installing vector related database dependencies...");let pg_vector_install_res = postgresql_extensions::install(
db.settings(),"portal-corp","pgvector_compiled",&VersionReq::parse("=0.16.12").expect("Failed to parse version provided to pg-vector."),).await;if pg_vector_install_res.is_err(){println!("Error while installing pg-vector: {:?}",
pg_vector_install_res.err());}let start_res = db.start().await;if start_res.is_err(){println!("Error when starting database: {:?}", start_res.err());}// Database needs to be created before the pool is created to avoid a 'database not// found' error.let create_res = db.create_database("fluster").await;if create_res.is_err(){
log::error!("Failed to create the fluster database.");println!("Failed to create the fluster database.");}let pool_res = PgPoolOptions::new().max_connections(5).connect(&uri).await;if pool_res.is_ok(){let pool = pool_res.unwrap();let res = sqlx::migrate!("./migrations").run(&pool).await;if res.is_err(){println!("Error here: {:?}", res.err());
log::error!("Failed to initialize database.");println!("Failed to initialize database.");}else{
log::info!("Successfully initialized database.");println!("Creating Fluster database...");let stop_res = db.stop().await;if stop_res.is_err(){println!("Error when stopping database: {:?}", stop_res.err())}
pool.close().await;}}else{
log::error!("Failed to initialize database.");println!("Failed to initialize database.");println!("Error down here: {:?}", pool_res.err());}}}else{// TODO: Send an event to the front end here.// on_error.send(FlusterError::FailToConnect);
log::error!("Failed to establish a local database connection. If you are using a common operating system and still encounter this error, please file an issue on Github.");}let res = app.emit("set-db-uri",SetDbConnectionUri{ uri });if res.is_err(){
log::error!("An error occurred while emitting the SetDbConnectionUri event.");}}#[cfg(test)]mod tests {usesuper::*;#[tokio::test]asyncfninitializes_database(){let app = tauri::test::mock_app();let handle = app.handle();initialize_database(handle).await;}}
What happens?
I just migrated from pg_embed to this library for the extensions support, which was foolish on my part to even start without having this taken care of right away because it's so crucial to the app, but now that I've migrated to this library I can't run the setup function.
Of course I've cleaned everything so it can start with a fresh slate, but it returns a 401 permissions error still every time
What did you expect to happen instead?
To setup the initial database by downloading the postgres binary.
Also, I am working on a public network at the local library, but I really don't have a way around that. I've tried this with 3 different networks now, and wasn't able to get past this 401 error.
The text was updated successfully, but these errors were encountered:
Hello @flusterIO, have you tried to manually download the binary from the postgres_binaries release? If you are able to manually download the correct version for you platform, one workaround would be to manually extract the contents. Alternatively, have you tried disabling the default features and using the zonky feature? This feature will attempt to download the archives from the same location that pg_embed was using (maven central).
Oh shoot I saw that zonky option and didn't think to look into what it did. I was in the middle of doing like 12 things at once, but it sounds like that's what I needed. Will that cause any issues with pg-vector, if I'm using a different binary?
@flusterIO I would expect the extension to work with either binary; caveat emptor: I have not tested it with the zonky binaries. Let me know if you run into any issues and we can try to figure out how to get things working for you.
Man I appreciate you getting back to me so fast. I'm insansely rushed with this but I know you got your own stuff to do too. The zonky feature worked great and all tests passed, so we're good to go. You can expect me to bug you again in the next day or two if I can't get the pg-vector working, but I have some other stuff I need to knock out between known and then.
What steps will reproduce the bug? (please provide code snippet if relevant)
What happens?
I just migrated from
pg_embed
to this library for the extensions support, which was foolish on my part to even start without having this taken care of right away because it's so crucial to the app, but now that I've migrated to this library I can't run the setup function.Of course I've cleaned everything so it can start with a fresh slate, but it returns a
401
permissions error still every timeWhat did you expect to happen instead?
To setup the initial database by downloading the postgres binary.
Information about your environment
Also, I am working on a public network at the local library, but I really don't have a way around that. I've tried this with 3 different networks now, and wasn't able to get past this 401 error.
The text was updated successfully, but these errors were encountered: