https://linen.dev logo
Join Discord
Powered by
# help
  • Passing #[shuttle_secrets::Secrets] to serenity EventHandler trait
    r

    rapid-shampoo-76081

    05/10/2023, 1:02 PM
    Hello, how can I use secret variables inside the EventHandler using
    shuttle_secrets
    ? snippet:
    Copy code
    #[async_trait]
    impl EventHandler for Handler {
        async fn ready(&self,
                       ctx: Context, ready: Ready) {
            let secret_var = if let Some(token) = secret_store.get("SECRET_VAR") {
                token
            } else {
                return Err(anyhow!("'SECRET_VAR' was not found").into());
            };
          
        }
    }
    
    #[shuttle_runtime::main]
    async fn serenity(
        #[shuttle_secrets::Secrets] secret_store: SecretStore,
    ) -> shuttle_serenity::ShuttleSerenity {
    
        Ok(client.into())
    }
    e
    • 2
    • 2
  • Build error with the Salvo example: the trait `From<Router>` is not implemented for `SalvoService`
    a

    agreeable-parrot-72483

    05/10/2023, 3:33 PM
    Hi, I've just installed Shuttle and thought I'd kick things off by using the Salvo example. However when I try to build it I hit this error:
    Copy code
    error[E0277]: the trait bound `SalvoService: From<Router>` is not satisfied
      --> src/main.rs:14:15
       |
    14 |     Ok(router.into())
       |               ^^^^ the trait `From<Router>` is not implemented for `SalvoService`
       |
       = help: the trait `From<salvo_core::routing::router::Router>` is implemented for `SalvoService`
       = note: required for `Router` to implement `Into<SalvoService>`
    
    For more information about this error, try `rustc --explain E0277`.
    error: could not compile `simplicity` due to previous error
    I haven't yet changed anything in the project. Thanks in advance! šŸ™‚
    a
    k
    +2
    • 5
    • 25
  • Hosting with Custom Domain
    b

    bulky-arm-3861

    05/10/2023, 5:14 PM
    What is the recommended way to host a shuttle project under a custom domain? CNAME records won't work because the URL is matched, which would then be wrong? A reverse proxy via nginx would probably work, but is that recommended/practical? Im testing out hosting my blog on shuttle but would like to keep my custom domain if possible. As a screenshot is the test i made attached where i just changed the CNAME to my shuttle custom domain

    https://cdn.discordapp.com/attachments/1105905804831379637/1105905805368246352/image.pngā–¾

    b
    g
    • 3
    • 8
  • Static folder example at https://docs.shuttle.rs/examples/axum not working
    c

    careful-flag-68889

    05/13/2023, 6:43 AM
    Copy code
    rust
    use std::path::PathBuf;
    
    use axum::{routing::get, Router};
    use axum_extra::routing::SpaRouter;
    
    async fn hello_world() -> &'static str {
        "Hello, world!"
    }
    
    #[shuttle_runtime::main]
    async fn axum(
        // Name your static assets folder by passing `folder = <name>` to `StaticFolder`
        // If you don't pass a name, it will default to `static`.
        #[shuttle_static_folder::StaticFolder(folder = "assets")] static_folder: PathBuf,
    ) -> shuttle_axum::ShuttleAxum {
        let router = Router::new()
            .route("/hello", get(hello_world))
            .merge(SpaRouter::new("/assets", static_folder).index_file("index.html"));
    
        Ok(router.into())
    }
    Error:
    Copy code
    2023-05-13T08:39:12.639700265Z DEBUG error[E0432]: unresolved import `axum_extra::routing::SpaRouter`
     --> src/main.rs:4:5
      |
    4 | use axum_extra::routing::SpaRouter;
      |     ^^^^^^^^^^^^^^^^^^^^^---------
      |     |                    |
      |     |                    help: a similar name exists in the module: `Router`
      |     no `SpaRouter` in `routing`
    
    
    2023-05-13T08:39:12.671257094Z DEBUG error[E0599]: no function or associated item named `new` found for struct `StaticFolder` in the current scope
      --> src/main.rs:10:1
       |
    10 | #[shuttle_runtime::main]
       | ^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `StaticFolder<'_>`
       |
       = help: items from traits can only be used if the trait is in scope
       = note: this error originates in the attribute macro `shuttle_runtime::main` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: the following trait is implemented but not in scope; perhaps add a `use` for it:
       |
    1  | use shuttle_service::ResourceBuilder;
       |
    Dependencies:
    Copy code
    toml
    [dependencies]
    shuttle-runtime = "0.14.0"
    axum = "0.6.17"
    shuttle-axum = "0.14.0"
    tokio = "1.28.0"
    shuttle-static-folder = "0.16.0"
    axum-extra = "0.7.4"
    Rust version: rust 1.71.0-nightly What is causing this?
    g
    a
    • 3
    • 21
  • How does shuttle deployment store files?
    t

    thousands-helicopter-92645

    05/13/2023, 4:58 PM
    Hey! 🐻 I have an "upload server" project called **rustypaste**: https://github.com/orhun/rustypaste I'm trying to deploy it to shuttle and I actually managed to do it: https://rustypaste.shuttleapp.rs However, since I don't exactly know how shuttle works, I'm curious how it happened out of the box. For example, now you can upload files like this:
    Copy code
    curl -F "file=@Cargo.toml" https://rustypaste.shuttleapp.rs
    Internally, are they uploaded inside an isolated container? If so, is there any disk/memory/cpu limits? Is there any documentation about this? Thank you for this great project!
    e
    g
    +3
    • 6
    • 18
  • Wondering how to set up secret_key
    f

    future-motorcycle-74352

    05/14/2023, 3:02 AM
    I'm using shuttle-secrets to provide SMTP config for a server that sends auth/verification emails. Currently I'm having trouble accessing the secrets data in a deployment, as I get an error saying that 'secret_key' isn't set. I can't find any documentation for this, nor find it in the shuttle.rs GitHub. Would love some help and maybe some updated documentation! Thanks!
    e
    g
    +3
    • 6
    • 15
  • shuttle doesn't deploy with build.rs or .env
    f

    future-motorcycle-74352

    05/15/2023, 3:40 AM
    Trying to set some compile time config to enable environment variables for sqlx, SMTP config and other stuff that I normally do. I would use shuttle secrets, but it's runtime only, and doesn't seem to support anything at build time. Would love an alternative, or for cargo shuttle to support more standard cargo features like .Env files, build scripts etc.
    e
    g
    • 3
    • 7
  • Youtube-dl & ffmpeg deploy
    s

    square-baker-38389

    05/15/2023, 9:31 AM
    I'm currently building Discord bot using serenity, poise and songbird. I'm wondering that when I
    cargo shuttle run
    my project, this program execute
    youtube-dl
    ,
    yt-dlp
    and
    ffmpeg
    on my local machine. How can I do to make my bot work (Cause the server may not have these command)
    a
    g
    • 3
    • 10
  • Initialized project can't run
    s

    square-baker-38389

    05/16/2023, 10:01 AM
    I currently get a error I just get before. I use
    cargo shuttle init poise
    to create a project then just run without any modify, it shows an error
    Copy code
    Building /Users/chenchaoting/Documents/Rust/bottt-poise
        Finished dev [unoptimized + debuginfo] target(s) in 0.16s
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 48, kind: AddrInUse, message: "Address already in use" }))', /Users/chenchaoting/.cargo/registry/src/github.com-1ecc6299db9ec823/shuttle-runtime-0.16.0/src/alpha/mod.rs:88:30
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: status: Unknown, message: "transport error", details: [], metadata: MetadataMap { headers: {} }
    
    Caused by:
        0: transport error
        1: http2 error: stream error received: stream no longer needed
        2: stream error received: stream no longer needed', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-shuttle-0.16.0/src/lib.rs:749:51
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    I get this when using serenity and fix it by setting
    RUSTUP_TOOLCHAIN 1.68
    but when migrating from serenity to poise, this get me an error.
    e
    • 2
    • 4
  • Deployment has not entered the running state
    e

    enough-exabyte-92081

    05/16/2023, 7:35 PM
    I'm using the latest version of shuttle (0.16) I checked logs and I see no problems. This is the terminal output:
    Copy code
    ...
    2023-05-16T21:27:44.448632133Z DEBUG hyper::client::connect::http: connecting to 127.0.0.1:18971
    2023-05-16T21:27:44.451173177Z DEBUG hyper::client::connect::http: connected to 127.0.0.1:18971
    2023-05-16T21:27:44.453423195Z DEBUG {service.ready=true} tower::buffer::worker: processing request
    2023-05-16T21:27:44.456117210Z  INFO shuttle_deployer::deployment::run: loading project from: /opt/shuttle/shuttle-executables/1861aef5-6744-4fee-bbc2-958b0ec05057
    2023-05-16T21:27:44.458121686Z DEBUG shuttle_deployer::deployment::run: loading service
    2023-05-16T21:27:44.460324723Z DEBUG {service.ready=true} tower::buffer::worker: processing request
    Deployment has not entered the running state
    And this is my code:
    Copy code
    rust
    #[shuttle_runtime::main]
    async fn actix_web(
        #[shuttle_shared_db::Postgres] pool: sqlx::PgPool,
        #[shuttle_secrets::Secrets] secret_store: shuttle_secrets::SecretStore,
        #[shuttle_static_folder::StaticFolder(folder = "templates")] static_folder: std::path::PathBuf,
    ) -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Send + Clone + 'static> {
        pool.execute("CREATE EXTENSION IF NOT EXISTS pgcrypto")
            .await
            .context("cannot create required extension")?;
    
        sqlx::migrate!()
            .run(&pool)
            .await
            .context("cannot generate migrations")?;
    
        let secret = secret_store
            .get("COOKIE_SECRET")
            .context("secret was not found")?;
    ........
    I see logs for the extension, but no for the migration. However there are no errors. Any idea why it's failing?
    a
    e
    +2
    • 5
    • 77
  • Connecting to MySql Database with Shuttle
    n

    nice-lamp-80603

    05/17/2023, 11:49 AM
    Hello I am new to rust and here, Please help. here is my code, how can I use Shuttle? Thank you #[rocket::main] async fn main() -> Result { let pool = MySqlPoolOptions::new() .max_connections(7) .connect("mysql://my-datase -credentials") .await?; let _ = rocket::build() .mount("/api/v1", routes![hello_world]) .manage(pool) .launch() .await.expect("Failed to start server or failed to connect to database"); Ok(()) }
  • How long does a deployment run for?
    a

    astonishing-tent-55899

    05/18/2023, 8:00 AM
    Not sure if I missed something in the documentation but I have recently deployed a project however after a period of time the services status shows as stopped. When I try to make requests to the URL it says that it cannot connect but then after checking the status again, the deployment status changes to ready. I'm guessing there is some time limit where if a service isn't active the deployment will be stopped. If so, how long would this time period be? Thanks in advance šŸ™‚
    g
    r
    • 3
    • 7
  • Overriding dependencies to test the local changes
    r

    rough-printer-11429

    05/19/2023, 11:24 AM
    I am following this link to set up local : https://docs.shuttle.rs/community/contribute i can't find .cargo/config.toml for overriding , i am on 'main' branch can i put them in cargo.toml ?

    https://cdn.discordapp.com/attachments/1109079151765372978/1109079152029610034/image.pngā–¾

    g
    • 2
    • 2
  • No project rm anymore?
    a

    average-grass-72372

    05/20/2023, 10:49 AM
    How can I delete a project in the cloud? There is no
    rm
    for
    cargo shuttle project
    • 1
    • 2
  • Cannot use Uuid::now_v7
    g

    great-insurance-57704

    05/20/2023, 12:09 PM
    In my pet project https://github.com/hseeberger/ticklist I am using the uuid crate with feature v7. This also requires rustflags --cfg uuid_unstable, hence I have provided a .cargo/config.toml. Non-shuttle builds (cargo build) as well as local runs (cargo shuttle run) work perfectly, yet deploying (cargo shuttle deploy) crashes with the following:
    Copy code
    2023-05-20T13:52:58.545699474Z  INFO    Compiling ticklist v0.1.0 (/opt/shuttle/shuttle-builds/ticklist)
    2023-05-20T13:52:58.757461205Z DEBUG error[E0599]: no function or associated item named `now_v7` found for struct `Uuid` in the current scope
      --> src/main.rs:99:21
       |
    99 |         .bind(Uuid::now_v7())
       |                     ^^^^^^
       |                     |
       |                     function or associated item not found in `Uuid`
       |                     help: there is an associated function with a similar name: `new_v4`
    
    
    2023-05-20T13:52:58.762462429Z DEBUG error[E0599]: no function or associated item named `now_v7` found for struct `Uuid` in the current scope
       --> src/main.rs:123:21
        |
    123 |         .bind(Uuid::now_v7())
        |                     ^^^^^^
        |                     |
        |                     function or associated item not found in `Uuid`
        |                     help: there is an associated function with a similar name: `new_v4`
    
    
    2023-05-20T13:52:58.769838490Z DEBUG error[E0599]: no function or associated item named `now_v7` found for struct `Uuid` in the current scope
       --> src/main.rs:148:21
        |
    148 |         .bind(Uuid::now_v7())
        |                     ^^^^^^
        |                     |
        |                     function or associated item not found in `Uuid`
        |                     help: there is an associated function with a similar name: `new_v4`
    
    
    2023-05-20T13:52:58.784627003Z DEBUG error: aborting due to 3 previous errors
    I assume that the custom rustflags are not picked up.
    g
    • 2
    • 4
  • Deploy with nightly
    i

    icy-tent-39655

    05/23/2023, 9:54 AM
    Hi, i'm new to Shuttle. I would like to deploy a test-app but have some trouble. I want to use the unstable feature async_fn_in_trait, which is by definition unavailable on stable. Would it be possible to deploy with a nightly toolchain?
    a
    d
    • 3
    • 5
  • `cargo shuttle login` won't grab the api key
    w

    wonderful-forest-43220

    05/23/2023, 11:00 AM
    I just built
    cargo-shuttle
    for Void Linux, when running
    cargo shuttle login
    I'm sent to the github login page, after logging in I get the dashboard, but I don't see API key anywhere. More details: I'm running Void Linux, but on WSL2, relying on https://github.com/wslutilities/wslu to open links in the browser on Windows (Firefox in my case).
    g
    • 2
    • 2
  • Deploy stuck in loading state
    l

    late-sandwich-93145

    05/25/2023, 10:36 AM
    I had a successful deploy of my serenity bot yesterday until all of a sudden it seemed to go offline. When I tired to check I was unable to run "shuttle logs" and it would result in a 503 error. The stop command was hanging so I figured to try another deploy. Now both the original deploy and the new deploy are stuck in "loading" state, the bot is offline and I can't issue a stop command. The original deploy has id 250ebd74-62a8-4d1f-889f-4dae3ccb7f29 The second deploy has id 215540d2-1001-4547-a83b-970d0928f541
    a
    b
    +2
    • 5
    • 51
  • Integrating Diesel into Rocket 0.5
    g

    gentle-agency-53651

    05/25/2023, 10:58 AM
    @User I created a very basic shuttle instance based off the documentation. I have been distracted on another project, but I really struggled to understand how I would integrate diesel into the mix as Rocket 0.5 has moved over to using stages as preferred methods of loading databases etc. So in my example the stage for loading postgres looks like this:
    Copy code
    rust
    use rocket::{fairing::AdHoc, Rocket, Build};
    
    use rocket_sync_db_pools::diesel;
    use crate::diesel_migrations::{MigrationHarness, EmbeddedMigrations};
    
    const MIGRATIONS: EmbeddedMigrations = embed_migrations!("db/migrations");
    
    #[database("db")]
    pub struct Db(diesel::PgConnection);
    
    async fn run_migrations(rocket: Rocket<Build>) -> Rocket<Build> {
        let conn = Db::get_one(&rocket).await.expect("database connection");
        conn.run(|c| { c.run_pending_migrations(MIGRATIONS).unwrap(); }).await;
        rocket
    }
    
    pub(crate) fn stage() -> AdHoc {
        AdHoc::on_ignite("Diesel Postgres Stage", |rocket| async {
            rocket.attach(Db::fairing())
                .attach(AdHoc::on_ignite("Diesel Migrations", run_migrations))
        })
    }
    a
    t
    • 3
    • 2
  • Error provisioning static folders
    a

    astonishing-laptop-19143

    05/25/2023, 6:30 PM
    Hello! I'm running into some issues when it comes to deploying. I recently added a folder called "static" to my root, containing a SSL cert. Whenever I try to deploy using
    shuttle_static_folder::StaticFolder
    I receive some errors. Here is my main function along with the error I'm receiving. It works when I run it using cargo shuttle run but doesn't seem to be able to deploy.
    Copy code
    #[shuttle_runtime::main]
    async fn start(
        #[shuttle_secrets::Secrets] secret_store: SecretStore,
        #[shuttle_static_folder::StaticFolder(folder = "static")] _static_folder: PathBuf
    ) -> Result<CustomService, shuttle_service::Error> {
        let discord_bot = bot::build_bot(secret_store).await?;
        let built_rocket = rocket::build();
        Ok(CustomService {
            discord_bot,
            built_rocket,
        })
    }

    https://cdn.discordapp.com/attachments/1111360713752059905/1111360713882079273/image.pngā–¾

    https://cdn.discordapp.com/attachments/1111360713752059905/1111360714217635970/image.pngā–¾

    a
    e
    • 3
    • 21
  • Installing `cargo-shuttle` fails
    c

    careful-iron-7275

    05/26/2023, 4:50 PM
    When trying to install the newest version via
    cargo install cargo-shuttle
    , I get the following compile error:
    Copy code
    error[E0308]: mismatched types
      --> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/shuttle-common-0.17.0/src/models/error.rs:27:43
       |
    27 |             self.message.to_string().with(Color::Red)
       |                                      ---- ^^^^^^^^^^ expected `crossterm::style::Color`, found `comfy_table::Color`   |                                      |
       |                                      arguments to this method are incorrect
       |
       = note: `comfy_table::Color` and `crossterm::style::Color` have similar names, but are actually distinct types
    note: `comfy_table::Color` is defined in crate `crossterm`
      --> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/crossterm-0.26.1/src/style/types/color.rs:28:1
       |
    28 | pub enum Color {
       | ^^^^^^^^^^^^^^
    note: `crossterm::style::Color` is defined in crate `crossterm`
      --> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/crossterm-0.25.0/src/style/types/color.rs:28:1
       |
    28 | pub enum Color {
       | ^^^^^^^^^^^^^^
       = note: perhaps two different versions of crate `crossterm` are being used?
    note: method defined here
      --> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/crossterm-0.25.0/src/style/stylize.rs:78:8
       |
    78 |     fn with(self, color: Color) -> Self::Styled {
    g
    c
    a
    • 4
    • 48
  • dashboard empty after deployment
    m

    melodic-battery-60890

    05/26/2023, 6:04 PM
    Is the shuttle dashboard suppose to show deployed instances? Mine is empty after deploying.
    a
    • 2
    • 2
  • Fetching git dependency crashes build
    g

    gentle-ice-1561

    05/26/2023, 9:43 PM
    When I try to redeploy my serenity bot, the Shuttle builder crashes when it tries to fetch the serenity repo.
    Copy code
    2023-05-26T23:26:56.666730297Z  INFO Entering building state
    2023-05-26T23:26:59.879154060Z  INFO     Updating `shuttle-crates-io-mirror` index
    2023-05-26T23:26:59.994664332Z  INFO     Updating git repository `https://github.com/Brendonovich/prisma-client-rust`
    2023-05-26T23:27:01.059305833Z  INFO     Updating git repository `https://github.com/serenity-rs/serenity`
    
    2023-05-26T23:27:04.091984054Z  INFO Entering crashed state
    2023-05-26T23:27:04.092030797Z ERROR {error="Build error: failed to get `serenity` as a dependency of package `wallace-minion v0.10.8 (/opt/shuttle/shuttle-builds/wallace-minion)`"} shuttle_deployer::deployment::queue: service build encountered an error
    a
    • 2
    • 5
  • Trying to run locally after adding postgres
    a

    astonishing-kitchen-45713

    05/27/2023, 3:57 PM
    I've got a serenity bot that has been deployed and running successfully for a while. Trying to add postgres, I've encountered some errors when starting up locally to test my changes. I'm on windows 10 with rustc 1.69.0 (84c898d65 2023-04-16), and have installed docker desktop specifically for this. The first time I tried to
    cargo shuttle run
    I get
    Copy code
    log
    2023-05-27T15:40:20.574720Z ERROR cargo_shuttle::provisioner_server: got unexpected error while inspecting docker container: error trying to connect: The system cannot find the file specified. (os error 2)
    2023-05-27T15:40:20.576845Z ERROR cargo_shuttle: failed to load your service error="Custom error: failed to provision shuttle_shared_db :: Postgres"
    Subsequent attempts each get
    Copy code
    log
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 10048, kind: AddrInUse, message: "Only one usage of each socket address (protocol/network address/port) is normally permitted." }))', C:\Users\<name>\.cargo\registry\src\github.com-1ecc6299db9ec823\shuttle-runtime-0.14.0\src\alpha\mod.rs:88:30
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Error: status: PermissionDenied, message: "Access is denied. (os error 5)", details: [], metadata: MetadataMap { headers: {} }
    I did try updating to
    0.17.0
    but then I can't even build as I get a
    Copy code
    log
    note: LINK : fatal error LNK1104: cannot open file '<path to my discord bot .exe>'
    so wasn't sure which to tackle first (or how)
    a
    g
    • 3
    • 8
  • Shuttle Persist & Serenity Discord Bot Compatibility
    m

    mammoth-cpu-45372

    05/27/2023, 11:46 PM
    Hey, I'm just wondering if the Shuttle Persist Serialize / Deserialize works with Serenity Discord bots
    e
    g
    • 3
    • 6
  • Service stuck loading indefinetily
    i

    icy-musician-50528

    05/28/2023, 9:54 AM
    Hey I've been trying to migrate a bot I've made over to shuttle. It uses poise, and axum. Yesterday it seemed to have worked fine, although I just changed the way migrations are applied from just executing the contents of a schema.sql file to using the sqlx migration macro, although I am not sure this has anything to do with this. Currently it's stuck on a loading state indefinitely with the last logs being:
    Copy code
    2023-05-28T12:32:08.415508031Z  INFO Entering loading state
    2023-05-28T12:32:08.420443815Z TRACE shuttle_deployer::runtime_manager: making new client
    2023-05-28T12:32:08.425105327Z DEBUG shuttle_deployer::runtime_manager: Starting alpha runtime at: /opt/shuttle/shuttle-executables/d3ea025d-fe4e-4972-a4b4-f0fe6d261912
    2023-05-28T12:32:10.428831483Z  INFO shuttle_proto::runtime: connecting runtime client
    2023-05-28T12:32:10.428925119Z DEBUG hyper::client::connect::http: connecting to 127.0.0.1:19498
    2023-05-28T12:32:10.431664770Z DEBUG hyper::client::connect::http: connected to 127.0.0.1:19498
    2023-05-28T12:32:10.434448027Z DEBUG {service.ready=true} tower::buffer::worker: processing request
    2023-05-28T12:32:10.437625123Z  INFO shuttle_deployer::deployment::run: loading project from: /opt/shuttle/shuttle-executables/d3ea025d-fe4e-4972-a4b4-f0fe6d261912
    2023-05-28T12:32:10.441717466Z DEBUG shuttle_deployer::deployment::run: loading service
    In case it does matter, the way migrations were run were changed from this:
    Copy code
    rust
      db.execute(include_str!("../schema.sql")).await.unwrap();
    to this:
    Copy code
    rust
    static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!();
    #[shuttle_runtime::main]
    async fn init(
        #[shuttle_shared_db::Postgres]
        db: sqlx::PgPool,
        #[shuttle_secrets::Secrets] secrets: shuttle_secrets::SecretStore,
    ) -> Result<CustomService, shuttle_runtime::Error> {
      ...
              MIGRATOR
                .run(&db)
                .await
                .map_err(|e| CustomError::new(e).context("Failed to apply migrations"))?;
      ...
     }
    • 1
    • 6
  • Trying to setup postgres locally, getting "failed to connect to provisioner"
    r

    refined-receptionist-71124

    05/28/2023, 11:06 AM
    I'm pretty new to postgres/docker, so this could be a very silly problem. I followed the docs [here](https://docs.shuttle.rs/introduction/local-run#local-runs-with-databases) and have a main function like:
    Copy code
    rs
    #[shuttle_runtime::main]
    async fn rocket(
        #[shuttle_aws_rds::Postgres()]
        pool: PgPool,
    ) -> shuttle_rocket::ShuttleRocket {
        pool.execute(include_str!("../schema.sql"))
            .await
            .map_err(CustomError::new)?;
    
        let state = MyState { pool: pool };
        let rocket = rocket::build()
            .mount("/v1.0", routes![outages, _area_search])
            .mount("/esp/2.0", routes![esp_index, esp_status])
            .manage(state);
    
        Ok(rocket.into())
    }
    I have docker and postgresql installed, but I haven't set anything up besides starting a postgres server. The docs aren't super clear about if any setup is needed? When I try to run locally with
    cargo shuttle run
    , I get:
    Copy code
    Finished dev [unoptimized + debuginfo] target(s) in 4.51s
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 48, kind: AddrInUse, message: "Address already in use" }))', /Users/brk/.cargo/registry/src/github.com-1ecc6299db9ec823/shuttle-runtime-0.17.0/src/alpha/mod.rs:87:30
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Error: status: Internal, message: "failed to connect to provisioner", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Sun, 28 May 2023 10:57:47 GMT", "content-length": "0"} }
    Which looks like it's either not provisioning a DB (but the whole idea is that this should be automatic, right?) or the address it's trying to use is in use (But I'm not sure what by?). Could someone point me in the right direction?
    s
    g
    a
    • 4
    • 18
  • How to discover DATABASE_URL when using sqlx locally
    s

    sparse-lamp-74430

    05/28/2023, 11:09 AM
    Hey, I want to use sqlx's query_as! macro which requires a database url to be set. When I 'cargo shuttle run' locally I can see a postgres container has spun up and I can get the db name and port of the local postgres from a docker inspect, but how do I find the user name and password? Or did I do it wrong?
    i
    a
    • 3
    • 5
  • Error building app locally
    i

    incalculable-addition-83746

    05/28/2023, 5:20 PM
    When I try to build my new app (that builds and deploys fine on shuttle) locally I get this error:
    Copy code
    Error: Custom { kind: Other, error: "protoc failed: google/protobuf/timestamp.proto: File not found.\nruntime.proto:4:1: Import \"google/protobuf/timestamp.proto\" was not found or had errors.\nruntime.proto:87:3: \"google.protobuf.Timestamp\" is not defined.\n" }
    Before you ask, I do have protoc installed:
    Copy code
    āÆ protoc --version
    libprotoc 3.19.6
    a
    • 2
    • 13
  • Callback handler failed
    g

    gentle-policeman-58466

    05/29/2023, 1:19 AM
    getting this error when logging into shuttle.rs.
    Copy code
    Callback handler failed. CAUSE: Missing state cookie from login request (check login URL, callback URL and cookie config).
    have tried different browsers, devices and cleared cookies with no avail. same as in this issue, but i cannot get access to the dashboard unlike the op https://github.com/shuttle-hq/shuttle/issues/697