From f69f89ed34399fd44a8d9dda39c0224cb449ed48 Mon Sep 17 00:00:00 2001 From: David Herberth Date: Thu, 16 Jan 2025 10:08:29 +0100 Subject: [PATCH] build: update axum dependency (#4450) --- Cargo.lock | 74 ++++++++++++++++---- Cargo.toml | 4 +- relay-server/src/endpoints/envelope.rs | 1 - relay-server/src/endpoints/mod.rs | 34 ++++----- relay-server/src/extractors/content_type.rs | 3 +- relay-server/src/extractors/forwarded_for.rs | 1 - relay-server/src/extractors/mime.rs | 3 +- relay-server/src/extractors/received_at.rs | 1 - relay-server/src/extractors/remote.rs | 2 - relay-server/src/extractors/request_meta.rs | 2 - relay-server/src/extractors/signed_json.rs | 2 - relay-server/src/middlewares/body_timing.rs | 2 +- relay-server/src/middlewares/sentry_tower.rs | 4 +- relay-server/src/service.rs | 1 - 14 files changed, 86 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb346a919a4..404f4ddefcf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -252,9 +252,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.4.5", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "itoa", + "matchit 0.7.3", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower 0.5.2", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d6fd624c75e18b3b4c6b9caf42b1afe24437daaee904069137d8bab077be8b8" +dependencies = [ + "axum-core 0.5.0", "axum-macros", "bytes", + "form_urlencoded", "futures-util", "http", "http-body", @@ -262,7 +289,7 @@ dependencies = [ "hyper", "hyper-util", "itoa", - "matchit", + "matchit 0.8.4", "memchr", "mime", "percent-encoding", @@ -298,25 +325,42 @@ dependencies = [ "sync_wrapper", "tower-layer", "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1362f362fd16024ae199c1970ce98f9661bf5ef94b9808fee734bc3698b733" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", "tracing", ] [[package]] name = "axum-extra" -version = "0.9.6" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" +checksum = "460fc6f625a1f7705c6cf62d0d070794e94668988b1c38111baeec177c715f7b" dependencies = [ - "axum", - "axum-core", + "axum 0.8.1", + "axum-core 0.5.0", "bytes", - "fastrand", "futures-util", "http", "http-body", "http-body-util", "mime", - "multer", "pin-project-lite", "serde", "tower 0.5.2", @@ -326,9 +370,9 @@ dependencies = [ [[package]] name = "axum-macros" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" +checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c" dependencies = [ "proc-macro2", "quote", @@ -2362,6 +2406,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "maxminddb" version = "0.24.0" @@ -3886,7 +3936,7 @@ dependencies = [ "ahash", "anyhow", "arc-swap", - "axum", + "axum 0.8.1", "axum-extra", "axum-server", "backoff", @@ -5329,7 +5379,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.7.9", "base64 0.22.1", "bytes", "h2", diff --git a/Cargo.toml b/Cargo.toml index 915638c0b4d..011923b0f27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,8 +66,8 @@ android_trace_log = { version = "0.3.0", features = ["serde"] } # which will increase processing time for transactions massively. # Keep it pinned until it's possible to disable backtrace. anyhow = "=1.0.69" -axum = "0.7.9" -axum-extra = "0.9.6" +axum = "0.8.1" +axum-extra = "0.10.0" axum-server = "0.7.1" arc-swap = "1.7.1" backoff = "0.4.0" diff --git a/relay-server/src/endpoints/envelope.rs b/relay-server/src/endpoints/envelope.rs index 63211e20501..150221b21ae 100644 --- a/relay-server/src/endpoints/envelope.rs +++ b/relay-server/src/endpoints/envelope.rs @@ -69,7 +69,6 @@ impl EnvelopeParams { } } -#[axum::async_trait] impl FromRequest for EnvelopeParams { type Rejection = BadEnvelopeParams; diff --git a/relay-server/src/endpoints/mod.rs b/relay-server/src/endpoints/mod.rs index a42e21ecc7d..c48d37baeb5 100644 --- a/relay-server/src/endpoints/mod.rs +++ b/relay-server/src/endpoints/mod.rs @@ -36,11 +36,11 @@ const BATCH_JSON_BODY_LIMIT: usize = 50_000_000; // 50 MB pub fn routes(config: &Config) -> Router{ // Relay-internal routes pointing to /api/relay/ let internal_routes = Router::new() - .route("/api/relay/healthcheck/:kind/", get(health_check::handle)) - .route("/api/relay/events/:event_id/", get(events::handle)); + .route("/api/relay/healthcheck/{kind}/", get(health_check::handle)) + .route("/api/relay/events/{event_id}/", get(events::handle)); let internal_routes = internal_routes // Fallback route, but with a name, and just on `/api/relay/*`. - .route("/api/relay/*not_found", any(statics::not_found)); + .route("/api/relay/{*not_found}", any(statics::not_found)); // Sentry Web API routes pointing to /api/0/relays/ let web_routes = Router::new() @@ -60,22 +60,22 @@ pub fn routes(config: &Config) -> Router{ // Legacy store path that is missing the project parameter. .route("/api/store/", store::route(config)) // cron monitor level routes. These are user facing APIs and as such support trailing slashes. - .route("/api/:project_id/cron/:monitor_slug/:sentry_key", monitor::route(config)) - .route("/api/:project_id/cron/:monitor_slug/:sentry_key/", monitor::route(config)) - .route("/api/:project_id/cron/:monitor_slug", monitor::route(config)) - .route("/api/:project_id/cron/:monitor_slug/", monitor::route(config)) + .route("/api/{project_id}/cron/{monitor_slug}/{sentry_key}", monitor::route(config)) + .route("/api/{project_id}/cron/{monitor_slug}/{sentry_key}/", monitor::route(config)) + .route("/api/{project_id}/cron/{monitor_slug}", monitor::route(config)) + .route("/api/{project_id}/cron/{monitor_slug}/", monitor::route(config)) - .route("/api/:project_id/store/", store::route(config)) - .route("/api/:project_id/envelope/", envelope::route(config)) - .route("/api/:project_id/security/", security_report::route(config)) - .route("/api/:project_id/csp-report/", security_report::route(config)) - .route("/api/:project_id/nel/", nel::route(config)) + .route("/api/{project_id}/store/", store::route(config)) + .route("/api/{project_id}/envelope/", envelope::route(config)) + .route("/api/{project_id}/security/", security_report::route(config)) + .route("/api/{project_id}/csp-report/", security_report::route(config)) + .route("/api/{project_id}/nel/", nel::route(config)) // No mandatory trailing slash here because people already use it like this. - .route("/api/:project_id/minidump", minidump::route(config)) - .route("/api/:project_id/minidump/", minidump::route(config)) - .route("/api/:project_id/events/:event_id/attachments/", post(attachments::handle)) - .route("/api/:project_id/unreal/:sentry_key/", unreal::route(config)) - .route("/api/:project_id/otlp/v1/traces/", traces::route(config)) + .route("/api/{project_id}/minidump", minidump::route(config)) + .route("/api/{project_id}/minidump/", minidump::route(config)) + .route("/api/{project_id}/events/{event_id}/attachments/", post(attachments::handle)) + .route("/api/{project_id}/unreal/{sentry_key}/", unreal::route(config)) + .route("/api/{project_id}/otlp/v1/traces/", traces::route(config)) // NOTE: If you add a new (non-experimental) route here, please also list it in // https://github.com/getsentry/sentry-docs/blob/master/docs/product/relay/operating-guidelines.mdx .route_layer(middlewares::cors()); diff --git a/relay-server/src/extractors/content_type.rs b/relay-server/src/extractors/content_type.rs index 08bcb822853..d6072002541 100644 --- a/relay-server/src/extractors/content_type.rs +++ b/relay-server/src/extractors/content_type.rs @@ -20,8 +20,7 @@ impl AsRef for RawContentType { } } -#[axum::async_trait] -impl FromRequestParts for RawContentType { +impl FromRequestParts for RawContentType { type Rejection = Infallible; async fn from_request_parts(parts: &mut Parts, _: &S) -> Result { diff --git a/relay-server/src/extractors/forwarded_for.rs b/relay-server/src/extractors/forwarded_for.rs index 0817cb2fc78..827aa4fac46 100644 --- a/relay-server/src/extractors/forwarded_for.rs +++ b/relay-server/src/extractors/forwarded_for.rs @@ -74,7 +74,6 @@ impl From for String { } } -#[axum::async_trait] impl FromRequestParts for ForwardedFor where S: Send + Sync, diff --git a/relay-server/src/extractors/mime.rs b/relay-server/src/extractors/mime.rs index f6e0ac451a0..9644732c2b2 100644 --- a/relay-server/src/extractors/mime.rs +++ b/relay-server/src/extractors/mime.rs @@ -39,8 +39,7 @@ impl IntoResponse for MimeError { } } -#[axum::async_trait] -impl FromRequestParts for Mime { +impl FromRequestParts for Mime { type Rejection = MimeError; async fn from_request_parts(parts: &mut Parts, _: &S) -> Result { diff --git a/relay-server/src/extractors/received_at.rs b/relay-server/src/extractors/received_at.rs index 4b61aca1eb0..927d3c3c12e 100644 --- a/relay-server/src/extractors/received_at.rs +++ b/relay-server/src/extractors/received_at.rs @@ -15,7 +15,6 @@ impl ReceivedAt { } } -#[axum::async_trait] impl FromRequestParts for ReceivedAt where S: Send + Sync, diff --git a/relay-server/src/extractors/remote.rs b/relay-server/src/extractors/remote.rs index f611476abc0..4a63ccda07b 100644 --- a/relay-server/src/extractors/remote.rs +++ b/relay-server/src/extractors/remote.rs @@ -21,7 +21,6 @@ use crate::utils::{self, ApiErrorResponse}; /// use crate::extractors::Remote; /// /// // Derive `FromRequest` for `bool` for illustration purposes: -/// #[axum::async_trait] /// impl axum::extract::FromRequest for Remote { /// type Rejection = Remote; /// @@ -45,7 +44,6 @@ impl From for Remote { } } -#[axum::async_trait] impl FromRequest for Remote> { type Rejection = Remote; diff --git a/relay-server/src/extractors/request_meta.rs b/relay-server/src/extractors/request_meta.rs index 55b6d91e5c0..5de1bab0316 100644 --- a/relay-server/src/extractors/request_meta.rs +++ b/relay-server/src/extractors/request_meta.rs @@ -460,7 +460,6 @@ impl PartialMeta { } } -#[axum::async_trait] impl FromRequestParts for PartialMeta { type Rejection = Infallible; @@ -622,7 +621,6 @@ struct StorePath { sentry_key: Option, } -#[axum::async_trait] impl FromRequestParts for RequestMeta { type Rejection = BadEventMeta; diff --git a/relay-server/src/extractors/signed_json.rs b/relay-server/src/extractors/signed_json.rs index e32bd3a49ab..9e6cb2e943f 100644 --- a/relay-server/src/extractors/signed_json.rs +++ b/relay-server/src/extractors/signed_json.rs @@ -71,7 +71,6 @@ pub struct SignedBytes { pub relay: RelayInfo, } -#[axum::async_trait] impl FromRequest for SignedBytes { type Rejection = SignatureError; @@ -105,7 +104,6 @@ pub struct SignedJson { pub relay: RelayInfo, } -#[axum::async_trait] impl FromRequest for SignedJson where T: DeserializeOwned, diff --git a/relay-server/src/middlewares/body_timing.rs b/relay-server/src/middlewares/body_timing.rs index 217b64bf8f9..007bde95184 100644 --- a/relay-server/src/middlewares/body_timing.rs +++ b/relay-server/src/middlewares/body_timing.rs @@ -45,7 +45,7 @@ impl BodyTiming { } } -impl Service> for BodyTiming +impl Service> for BodyTiming where S: Service>, { diff --git a/relay-server/src/middlewares/sentry_tower.rs b/relay-server/src/middlewares/sentry_tower.rs index d96e2e584af..e0f0f00de24 100644 --- a/relay-server/src/middlewares/sentry_tower.rs +++ b/relay-server/src/middlewares/sentry_tower.rs @@ -256,7 +256,7 @@ where H: Into>, { provider: P, - _hub: PhantomData<(H, Request)>, + _hub: PhantomData (H, Request)>, } impl Layer for SentryLayer @@ -296,7 +296,7 @@ where { service: S, provider: P, - _hub: PhantomData<(H, Request)>, + _hub: PhantomData (H, Request)>, } impl Service for SentryService diff --git a/relay-server/src/service.rs b/relay-server/src/service.rs index 4f0606d8873..f4ef8f3506d 100644 --- a/relay-server/src/service.rs +++ b/relay-server/src/service.rs @@ -496,7 +496,6 @@ fn initialize_redis_scripts( Ok(()) } -#[axum::async_trait] impl FromRequestParts for ServiceState { type Rejection = Infallible;