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

[batching] fix subgraph unwrapping #4849

Merged
merged 3 commits into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions apollo-router/src/services/subgraph_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,12 +805,15 @@ pub(crate) async fn process_batch(
}

tracing::debug!("parts: {parts:?}, content_type: {content_type:?}, body: {body:?}");
let value = serde_json::from_slice(&body.unwrap().unwrap()).map_err(|error| {
FetchError::SubrequestMalformedResponse {
let value =
serde_json::from_slice(&body.ok_or(FetchError::SubrequestMalformedResponse {
service: service.to_string(),
reason: "no body in response".to_string(),
})??)
garypen marked this conversation as resolved.
Show resolved Hide resolved
.map_err(|error| FetchError::SubrequestMalformedResponse {
service: service.to_string(),
reason: error.to_string(),
}
})?;
})?;

tracing::debug!("json value from body is: {value:?}");

Expand Down Expand Up @@ -1038,7 +1041,7 @@ pub(crate) async fn call_http(

let (parts, _) = subgraph_request.into_parts();
let body = serde_json::to_string(&body).expect("JSON serialization should not fail");
tracing::info!("our JSON body: {body:?}");
tracing::debug!("our JSON body: {body:?}");
let mut request = http::Request::from_parts(parts, Body::from(body));

request
Expand Down