No function or associated item named `new` found f...
# help
b
I am getting the above error on my shuttle_runtime::main. I am trying to user Postgres, in my Cargo.toml I think I have everything I need:
Copy code
toml
shuttle-runtime = "0.14.0"
axum = "0.6.16"
shuttle-axum = "0.14.0"
tokio = "1.27.0"
serde = "1.0.160"
tower-http = { version = "0.4.0", features = ["cors"] }
shuttle-secrets = "0.14.0"
anyhow = "1.0.70"
sqlx = { version = "0.6.3", features = ["postgres", "runtime-tokio-native-tls"] }
shuttle-shared-db = { version = "0.15.0", features = ["postgres"] }
My main function looks as follows:
Copy code
rust
#[shuttle_runtime::main]
async fn axum(
    #[shuttle_shared_db::Postgres] postgres: Database,
    #[shuttle_secrets::Secrets] secrets: SecretStore,
) -> shuttle_axum::ShuttleAxum {
    sqlx::migrate!().run(&postgres).await.expect("Error running postgres migrations");

    let front_end_url = if let Some(secret) = secrets.get("FRONT_END_URL") {
        secret
    } else {
        return Err(anyhow!("Unable to find secret FRONT_END_URL").into());
    };

    let cors = CorsLayer::new()
        .allow_credentials(true)
        .allow_methods([Method::GET])
        .allow_origin(front_end_url.parse::<HeaderValue>().unwrap());

    let router = Router::new()
        .route("/get_json", get(get_json))
        .layer(cors);

    Ok(router.into())
}
I'm not sure what I'm missing here, is there a dependency I am missing? Cheers
Database
is currently just
type Database = sqlx::PgPool
e
your shuttle_shared_db version doesn't match the other shuttle dependency versions
bump 'em all to 0.15 and see if that sorts it out
b
thank you this has worked 👍