-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: shuttle 0.13.0; Rocket; rocket_dyn_templates; project fails to deploy #763
Comments
For reference, the numbers decode into |
For the record I tried with shuttle_static_folder 0.13.1 but results were the same. |
Same problem here. Works with |
JFYI: Problem still present with 0.14.0
|
@pogopaule 0.14.0 also fails for me. But interestingly I don't get the same error as you. Are you able to share your code somewhere? Maybe I can help. |
@jhawkesworth I am not able to reproduce the logs I posted above. I tested various things, including version changes. Unfortunately I cannot share the code. I'll look into other services like render, fly.io, etc. since this bug is a show stopper for my project. P.S. An idea for a workaround I haven't tested yet: one could render the templates with the help of the handlebars crate directly and keep the content of the hbs files inside rust files... |
Hey! I'm not super familiar with rocket so I may be off here, but I assume this has to do with how the |
@oddgrd Rocket does this via |
Hmmm 🤔 Did you try using this to pass in the path that you get in your shuttle main function from |
🚀 you are right @oddgrd! This works #[shuttle_runtime::main]
async fn rocket(
[...]
#[shuttle_static_folder::StaticFolder] static_folder: PathBuf,
) -> shuttle_rocket::ShuttleRocket {
[...]
let template_dir = static_folder.to_str().unwrap();
let figment = rocket::Config::figment().merge(("template_dir", template_dir));
let rocket = rocket::custom(figment)
.attach(Template::fairing())
.mount(
[...] Thank you! 👍 |
@oddgrd Thank you this fix also works for my project. |
Examples project pull request added, once it (or something better) gets merged, let's close this one. |
Nice! 🥳 I remembered incorrectly, the path to the folder will be consistent, but it will not be in the same directory as your executable. I think this is a classic case of the "magic" of a framework making it difficult to figure out what went wrong, as you would expect the folder to be in the crate root. We should add this to the docs for Thanks for the examples too, they look good! ❤️ We have a lot of examples for rocket already though, so perhaps we should do just the one with handlebars, since that shows adding the path to the rocket config as well? |
@oddgrd Thank you for speedy review. Agree with the above. Have removed the static-folder example from my examples PR shuttle-hq/shuttle-examples#38 and opened above PR to update the static-folder documentation. |
What happened?
I have been unable to get a test project to deploy to shuttle when using rocket_dyn_templates feature of Rocket
https://api.rocket.rs/v0.5-rc/rocket_dyn_templates/index.html
My code is available here: https://github.com/jhawkesworth/jh-rocket-fs
If you are starting from a clean project, be aware that the default location for templates is a sub-folder called 'templates', relative to crate root. If you want to use a different folder, it appears this may only be specified in Rocket.toml, but I have had no luck getting the Rocket.toml included in the project, so the example above specifies a static folder called 'templates'.
Version
v0.13.0
Which operating systems are you seeing the problem on?
Linux
Which CPU architectures are you seeing the problem on?
x86_64
Relevant log output
Duplicate declaration
The text was updated successfully, but these errors were encountered: