Skip to content

[Bug]: Leptos SSR feature doesn't work nicely with shuttle #1002

@joshua-mo-143

Description

@joshua-mo-143

What happened?

repo link https://github.com/joshua-mo-143/lta
original thread link https://discord.com/channels/803236282088161321/1118239204850290729

using cargo shuttle 0.18.0 with dependencies at 0.18.0

when using cargo run --no-default-features --features=ssr shuttle run (or something similar) it just says the future can't be sent safely between threads:

error: future cannot be sent between threads safely
  --> src/main.rs:2:1
   |
2  | #[shuttle_runtime::main]
   | ^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `loader` is not `Send`
   |
   = help: within `LocalSet`, the trait `Sync` is not implemented for `*const ()`
note: required by a bound in `start`
  --> /home/joshuamo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shuttle-runtime-0.18.0/src/alpha/mod.rs:52:33
   |
52 | pub async fn start(loader: impl Loader<ProvisionerFactory> + Send + 'static) {
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `start`
   = note: this error originates in the attribute macro `shuttle_runtime::main` (in Nightly builds, run with -Z macro-backtrace for more info)

using cargo shuttle run returns this:

    Building /home/joshuamo/lta
   Compiling leptos-tailwind v0.1.0 (/home/joshuamo/lta)
    Finished dev [unoptimized + debuginfo] target(s) in 4.02s
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: connecting runtime client

Caused by:
    0: transport error
    1: error trying to connect: tcp connect error: Connection refused (os error 111)
    2: tcp connect error: Connection refused (os error 111)
    3: Connection refused (os error 111)', /home/circleci/project/cargo-shuttle/src/lib.rs:772:51

It looks like the codegen is being ran on top of the Leptos feature restriction meaning that the shuttle runtime macro runs into problems when trying to use the SSR feature.

Version

v0.18.0

Which operating system(s) are you seeing the problem on?

Linux

Which CPU architectures are you seeing the problem on?

x86_64

Relevant log output

error: future cannot be sent between threads safely
  --> src/main.rs:2:1
   |
2  | #[shuttle_runtime::main]
   | ^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `loader` is not `Send`
   |
   = help: within `LocalSet`, the trait `Sync` is not implemented for `*const ()`
note: required by a bound in `start`
  --> /home/joshuamo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shuttle-runtime-0.18.0/src/alpha/mod.rs:52:33
   |
52 | pub async fn start(loader: impl Loader<ProvisionerFactory> + Send + 'static) {
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `start`
   = note: this error originates in the attribute macro `shuttle_runtime::main` (in Nightly builds, run with -Z macro-backtrace for more info)

Duplicate declaration

  • I have searched the issues and there are none like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-AcceptedThis will be worked on

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions