Skip to content

Leptos SSR Bug, 500 Internal Server Error browser error. #3832

Open
@sangelxyz

Description

@sangelxyz

Describe the bug
Using Leptos with SSR/Hydrate, I have used the default Cargo Leptos Axum starter template and modified it with the bug.

The bug can be seen here
https://github.com/sangelxyz/leptos_bug_serverfn

This will compile fine, but clicking next page will cause 500 internal server error in the Browser Console.

The Error seems to be caused by a blank Vec in my Filter struct. Putting a value say 1 will now have no errors.

Leptos Dependencies
Default cargo leptos axum starter template

Please copy and paste the Leptos dependencies and features from your Cargo.toml.

[dependencies]
leptos = { version = "0.7.0" }
leptos_router = { version = "0.7.0" }
axum = { version = "0.7", optional = true }
console_error_panic_hook = { version = "0.1", optional = true}
leptos_axum = { version = "0.7.0", optional = true }
leptos_meta = { version = "0.7.0" }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
wasm-bindgen = { version = "=0.2.100", optional = true }
serde = { version = "1.0.219", features = ["derive"] }

[features]
hydrate = [
    "leptos/hydrate",
    "dep:console_error_panic_hook",
    "dep:wasm-bindgen",
]
ssr = [
    "dep:axum",
    "dep:tokio",
    "dep:leptos_axum",
    "leptos/ssr",
    "leptos_meta/ssr",
    "leptos_router/ssr",
]

To Reproduce
Steps to reproduce the behavior:

  1. Go to Clone my repo above
  2. run cargo leptos watch
  3. open your browser console and click next.
  4. under network tabs you will see a 500 internal server error.
  5. Line 85 of app.rs change countries to include a number inside the vec. vec![1] This application then will work with no errors.

Screenshots
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions