Skip to content
Discussion options

You must be logged in to vote

Are you the same person that asked in Discord?

It looks like you are using the Timeout middleware from tower, which has an Error type of Box<dyn Error + ...>. Axum requires your middlewares to have an Error type of Infallible, because usually an error at the tower service level is not what you want (here a timeout would immediately close the client connection, instead of sending a timeout HTTP response).

You can either use axum's HandleErrorLayer to map the error into a response, or tower-http's timeout middleware https://docs.rs/tower-http/latest/tower_http/timeout/index.html as they don't change the service error type.

Replies: 2 comments 1 reply

This comment has been hidden.

@taiki-e

This comment has been hidden.

Comment options

You must be logged in to vote
0 replies
Answer selected by davidpdrsn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants