https://linen.dev logo
i want to use an existing database however im unab...
# help
f
im unable to see any the errors preventing deployment
Copy code
#[shuttle_service::main]
async fn actix_web(
    #[shuttle_secrets::Secrets] secret_store: SecretStore,
) -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Sync + Send + Clone + 'static> {
    let secret = if let Some(secret) = secret_store.get("CONNECTION_STRING") {
        secret
    } else {
        return Err(anyhow!("Failed to get connection string").into());
    };

    let connection_pool = PgPool::connect(&secret)
        .await
        .expect("Failed to connect to postgres");

    let state = web::Data::new(AppState {
        pool: connection_pool,
    });

    Ok(move |cfg: &mut ServiceConfig| {
        cfg.service(
            web::scope("/hash")
                .wrap(Logger::default())
                .service(retrieve)
                .service(add)
                .app_data(state),
        );
    })
}
g
Can you run it locally?
cargo shuttle run
Also, does
cargo shuttle logs
give you anything?
f
[1] 93967 bus error cargo shuttle run
shuttle init didn't generate a shuttle.toml
fixed that error. but its saying from the code above it can't get the connection string. i have a folder called secrets containing Secrets.toml
g
Ok, try moving the Secrets.toml out of the folder, to the root of the project.
f
yeee saw that in a diff example that it was in the root. have now moved it out
just getting a general panic now
Copy code
2023-03-01T19:49:53.754969410Z ERROR {error="Run error: Panic occurred in shuttle_service::main`: panicked calling main"} shuttle_deployer::deployment::run: service startup encountered an error
g
Was this on a
deploy
or local
run
?
f
both
neither work
g
What versions of Rust and Shuttle (check both
cargo shuttle -V
and in Cargo.toml) have you got?
f
rust v1.67.1 cargo-shuttle 0.11.0 on machine and shuttle-service = { version = "0.11.0", features = ["web-actix-web"] } in cargo.toml
i can now deploy but cargo shuttle run does not work
g
Are you on running it in Windows or another platform?
f
mac m1
g
Then I'm not sure what could be the cause, hopefully someone else knows.
f
just saw this
could be my missing piece
g
I see there is a typo in that link, but you probably found the
Installation
page
f
i ended up switching off of actix to rocket
still cannot run locally
the api is simple enough that i deployed and was able to test
ty for your help !
a
actix tends to be a bit temperamental on shuttle unfortunately