https://linen.dev logo
Deployment Fails [Serenity]
# help
o
HI! I'm trying out Shuttle to host my Serenity bot, but the deployment fails with a pretty unhelpful message. I am pretty new to Rust and my bot was using a binary that I had to convert to a library to get it working with Shuttle. I suspect the problem is related to how I converted it but I'm not sure what the exact issue is. The crash logs just say this:
Copy code
rust
2023-01-28T15:06:36.545019056Z ERROR {error="Run error: Panic occurred in shuttle_service::main`: panicked calling main"} shuttle_deployer::deployment::run: service startup encountered an error
I am able to run my bot locally with
cargo shuttle run
without any issues. My repo is public if you need to look at the code: https://github.com/InfernapeXavier/annie-mai/tree/ann-24-try-out-hosting-on-shuttlers
a
It looks like you need to use shuttle macros to convert it to a shuttle project and your entry point function also needs to be in a Lib.rs file
also you will probably want to use the shuttle_secrets library so you can use secrets in prod
a
Ah I'm on your main branch, whoops
I'm guessing the error is probably that you're trying to use .env instead of using shuttle_secrets combined with a Secrets.toml file as your main function automatically panics due to not being able to find a .env file (either that or the
#[instrument]
macro? but I highly doubt that) since the macro seems to have called that error because of panicking during main function execution At some point I'll try and write some documentation for a mini-guide on converting an existing project to use shuttle to avoid this kind of thing from happening since it's not immediately obvious
o
Hmm, is there no Support for
env
vars, or is the problem that
env
vars don't behave as expected in Shuttle? I'm asking because I'm looking at the example for
shuttle_secrets
and I don't see a way of injecting vars ad-hoc which I don't think will work with my current setup and how I'm using
env
vars
Yup, that was the problem. Moving to
shuttle_secrets
makde the deploy work. Sadly I don't think I can use it because I need to arbitrarily load the secrets in a few different flows. But thanks for your help!
Also ran into this problem while trying to stop my deployment https://discord.com/channels/803236282088161321/1050094956355784774/1050094956355784774 I'm not even using the db service so I'm not sure how to fix that
a
I'd like to refer you to this particular thread as it gives a more in-depth look at that particular issue: https://discord.com/channels/803236282088161321/1068152912380952656/1068157695158407169
Once the team is back on Monday they should be able to look into this for you