The axum-auth fullstack example fails with called `Result::unwrap()` on an `Err` value: ServerError("AuthSessionLayer was not found") when clicking the Login Test User button.
I suspect that this is caused by an incorrect handling of the DioxusServerContext.
Debugging shows that the map returned by server_context().request_parts_mut().await.extensions (in the login() server function) is empty.
The following diff (https://github.com/DioxusLabs/dioxus/commit/27a2237d09744e99514e6a41481ca75caebb5401) seems to fix the issue, but I'm not sure if that is the correct approach:
@@ -483,7 +483,7 @@ async fn handle_server_fns_inner(
let referrer = req.headers().get(REFERER).cloned();
// actually run the server fn
- let mut res = service.run(req).await;
+ let mut res = ProvideServerContext::new(service.run(req), server_context.clone()).await;
Steps To Reproduce
Steps to reproduce the behavior:
Run dx serve --platform fullstack in \packages\fullstack\examples\axum-auth
Click the Login Test User button
Check browser console for errors
Environment:
Dioxus version: main (revision cba3abccf4ae8237c0cdd4b5740f0096cbb12531)
Rust version: rustc 1.75.0 (82e1608df 2023-12-21)
OS info: Windows 11
App platform: fullstack
Questionnaire
[ ] I'm interested in fixing this myself but don't know where to start
[ ] I would like to fix and I have a solution
[ ] I don't have time to fix this right now, but maybe later
Problem
The
axum-auth
fullstack example fails withcalled `Result::unwrap()` on an `Err` value: ServerError("AuthSessionLayer was not found")
when clicking theLogin Test User
button.I suspect that this is caused by an incorrect handling of the
DioxusServerContext
. Debugging shows that the map returned byserver_context().request_parts_mut().await.extensions
(in thelogin()
server function) is empty. The following diff (https://github.com/DioxusLabs/dioxus/commit/27a2237d09744e99514e6a41481ca75caebb5401) seems to fix the issue, but I'm not sure if that is the correct approach:Steps To Reproduce
Steps to reproduce the behavior:
dx serve --platform fullstack
in\packages\fullstack\examples\axum-auth
Login Test User
buttonEnvironment:
cba3abccf4ae8237c0cdd4b5740f0096cbb12531
)rustc 1.75.0 (82e1608df 2023-12-21)
fullstack
Questionnaire