Skip to content

Commit a0ec278

Browse files
committed
chore(service): log better the any error while parsing receipts headers
1 parent f8120db commit a0ec278

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/service/src/middleware/tap_receipt.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ use crate::service::TapHeader;
1414
///
1515
/// This is useful to not deserialize multiple times the same receipt
1616
pub async fn receipt_middleware(mut request: Request, next: Next) -> Response {
17+
// First check if header exists to distinguish missing vs invalid
18+
let has_tap_header = request.headers().contains_key("tap-receipt");
19+
1720
match request.extract_parts::<TypedHeader<TapHeader>>().await {
1821
Ok(TypedHeader(TapHeader(receipt))) => {
1922
let version = match &receipt {
@@ -27,7 +30,11 @@ pub async fn receipt_middleware(mut request: Request, next: Next) -> Response {
2730
request.extensions_mut().insert(receipt);
2831
}
2932
Err(e) => {
30-
tracing::debug!(error = %e, "No TAP receipt found in request headers");
33+
if has_tap_header {
34+
tracing::error!(error = %e, "TAP receipt header present but invalid");
35+
} else {
36+
tracing::warn!("TAP receipt header missing (likely free query)");
37+
}
3138
}
3239
}
3340
next.run(request).await

0 commit comments

Comments
 (0)