Skip to content

Commit 559833d

Browse files
committed
Fix reqwest custom user-agent for S3
1 parent 96ed926 commit 559833d

File tree

1 file changed

+10
-2
lines changed
  • aggregation_mode/src/backend

1 file changed

+10
-2
lines changed

aggregation_mode/src/backend/s3.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@ pub enum GetBatchProofsError {
66
Deserialization,
77
EmptyBody,
88
StatusFailed,
9+
ReqwestClientFailed
910
}
1011

12+
// needed to make S3 bucket work
13+
const DEFAULT_USER_AGENT: &str = "proof-aggregator/aligned-layer";
14+
1115
pub async fn get_aligned_batch_from_s3(
1216
url: String,
1317
) -> Result<Vec<VerificationData>, GetBatchProofsError> {
14-
let response = reqwest::get(url)
18+
let client = reqwest::Client::builder()
19+
.user_agent(DEFAULT_USER_AGENT)
20+
.build()
21+
.map_err(|_| GetBatchProofsError::ReqwestClientFailed)?;
22+
23+
let response = client.get(url).send()
1524
.await
1625
.map_err(|_| GetBatchProofsError::Fetching)?;
17-
1826
if !response.status().is_success() {
1927
return Err(GetBatchProofsError::StatusFailed);
2028
}

0 commit comments

Comments
 (0)