Chapter 2.5 Working with a Database: Injecting the database connection - fails accourding to trait bound `shuttle_shared_db::Postgres: ResourceInputBuilder` is not satisfied
Hello :)
I´m sorry for opening up a issue, but i can´t help me out.
As I was following the instructions from your Tutorial i ran into this error. I checked it multiple times and can say i exactly followed the instructions.
error[E0277]: the trait bound shuttle_shared_db::Postgres: ResourceInputBuilderis not satisfied --> api/shuttle/src/main.rs:11:7 #[shuttle_shared_db::Postgres()] pool: sqlx::PgPool, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the traitResourceInputBuilderis not implemented forshuttle_shared_db::Postgres`
error[E0599]: no function or associated item named default found for struct shuttle_shared_db::Postgres in the current scope
--> api/shuttle/src/main.rs:9:1
#[shuttle_runtime::main]
|^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in Postgres
`
As an absolute beginner i would be very thankfull for a solution to this problem, i can´t figure out myself.
Hello :)
I had the same issue. By looking at the shuttle repository : https://github.com/shuttle-hq/shuttle-examples/blob/main/actix-web/postgres/Cargo.toml I found that you should replace the lines to paste in the api/shuttle/Cargo.toml file ( shuttle-shared-db = { version = "0.36.0", features = ["postgres"] } sqlx = { version = "0.7", default-features = false, features = [ "tls-native-tls", "macros", "postgres", "uuid", "chrono", "json", ] }), by those lines : shuttle-shared-db = { version = "0.42.0", features = ["postgres", "sqlx"] } sqlx = "0.7.1"
Hello Arnaud,
thank you for your support 🙏☺️
now should be:
shuttle-shared-db = { version = "0.46.0", features = ["postgres", "sqlx"] }
sqlx = "0.7.1"
Hi all! sorry for late response, I will try to update the workshop with new versions of Shuttle and Dioxus, Thank you all for your patience :pray:
@philipp10348r574kdfje I recently updated both project on main branch and Docs for the issue you had.
As @denverbaumgartner correctly mention, sqlx was missing on shuttle-shared-db crate, thanks for your comment!
Also I worth mentionning you have to change how you initialize Postgress pool on #[shuttle_runtime::main], the attribute now don't need ().
Updated some dependencies on Backend side, specially Shuttle crates.
Closing issue , if you have more doubts or you found some errors, happy to help and sorry again for the delay on the fix :pray: