Skip to content
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

Axum tutorial is broken #469

Closed
dpasirst opened this issue Jan 1, 2025 · 3 comments · Fixed by #470 or #471
Closed

Axum tutorial is broken #469

dpasirst opened this issue Jan 1, 2025 · 3 comments · Fixed by #470 or #471

Comments

@dpasirst
Copy link

dpasirst commented Jan 1, 2025

The axum tutorial seems wildly broken :-(

I did this

git clone https://github.com/kanidm/webauthn-rs.git
# optional (same problem with or without): git checkout v0.5.1
cd webauthn-rs/tutorial
make axum

I expected the following

to successfully build the tutorial AND for the tutorial to work (see "Any other comments")

What actually happened

cd server/axum && ./build_wasm.sh && cargo run
Error: `cargo metadata` exited with an error: error: failed to parse manifest at `/Users/dave/developer/rust/webauthn-rs/tutorial/wasm/Cargo.toml`

Caused by:
  error inheriting `serde_json` from workspace root manifest's `workspace.dependencies.serde_json`

Caused by:
  failed to find a workspace root

Caused by: `cargo metadata` exited with an error: error: failed to parse manifest at `/Users/dave/developer/rust/webauthn-rs/tutorial/wasm/Cargo.toml`

Caused by:
  error inheriting `serde_json` from workspace root manifest's `workspace.dependencies.serde_json`

Caused by:
  failed to find a workspace root

Version (and git commit)

96ddb68 but also with tag v0.5.1

Rust: 1.83.0
wasm-pack 0.13.1

Operating System / Version

macOS 15.2

Any other comments

The build is just the first problem. There are several other things broken with the tutorial code (note: these problems are with the tutorial code only, while the webauthn-rs/compat_tester/webauthn-rs-demo does seem to work (at least I am prompted to register a passkey).

After modifying webauthn-rs/tutorial/wasm/Cargo.toml and webauthn-rs/tutorial/server/axum/Cargo.toml to get the code to build. The server starts listening on port 8080 but the demo does not function.

  • The assets/wasm/index.html file expects ./wasm.js and ./wasm_bg.wasm however, the files available are ./wasm_tutorial.js and ./wasm_tutorial_bg.wasm. After modifying the index.html to the new names, the start_register appears to work per the server logs but I'm never prompted to register a passkey. The browser (chrome) inspect console shows a list of unintelligible errors from the wasm code.
  • Modifying the build feature for 'javascript' instead of 'wasm' is also a problem. Going to https://localhost:8080/ returns a 404 error because main.rs code has the following lines:
    #[cfg(feature = "javascript")]
    let app = Router::new()
        .merge(app)
        .nest_service("/assets", tower_http::services::ServeDir::new("assets/js"));
      ### ^^^^^^^^^^^^^^^^^^^^^^^^^########
     # "/assets" probably should be "/"

After making that change, then assets/index.html requires /assets/auth.js to be modified to /auth.js. But even then the tutorial itself fails to complete registration with seemingly start_register being called no prompt to register a passkey.

@Firstyear
Copy link
Member

@dpasirst Edit the make file and change

axum: ## Build and run the axum server
axum:
	cd server/axum && ./build_wasm.sh && cargo run

to

axum: ## Build and run the axum server
axum:
	cd server/axum && cargo run

@dpasirst
Copy link
Author

dpasirst commented Jan 2, 2025

@Firstyear - that fixes the compiling of the tutorial (THANKS!), but not the tutorial itself. That is still broken per the comments in the Any other comments section.

@dpasirst
Copy link
Author

dpasirst commented Jan 2, 2025

@Firstyear - FYI: #470 (comment)

@yaleman yaleman mentioned this issue Jan 3, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants