build(deps): update aws dependencies (#4194)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in>
This commit is contained in:
Chethan Rao
2025-03-19 16:48:46 +05:30
committed by GitHub
parent 5ee217175c
commit afca506369
6 changed files with 679 additions and 806 deletions

View File

@ -26,9 +26,9 @@ currency_conversion = { version = "0.1.0", path = "../currency_conversion" }
#Third Party dependencies
actix-web = "4.5.1"
async-trait = "0.1.79"
aws-config = { version = "1.1.9", features = ["behavior-version-latest"] }
aws-sdk-lambda = { version = "1.18.0" }
aws-smithy-types = { version = "1.1.8" }
aws-config = { version = "1.5.10", features = ["behavior-version-latest"] }
aws-sdk-lambda = { version = "1.60.0" }
aws-smithy-types = { version = "1.3.0" }
bigdecimal = { version = "0.4.5", features = ["serde"] }
error-stack = "0.4.1"
futures = "0.3.30"
@ -38,7 +38,7 @@ reqwest = { version = "0.11.27", features = ["serde_json"] }
rust_decimal = "1.35"
serde = { version = "1.0.197", features = ["derive", "rc"] }
serde_json = "1.0.115"
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio", "runtime-tokio-native-tls", "time", "bigdecimal"] }
sqlx = { version = "0.8.3", features = ["postgres", "runtime-tokio", "runtime-tokio-native-tls", "time", "bigdecimal"] }
strum = { version = "0.26.2", features = ["derive"] }
thiserror = "1.0.58"
time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] }

View File

@ -17,12 +17,12 @@ dynamic_routing = ["dep:prost", "dep:tonic", "dep:tonic-reflection", "dep:tonic-
[dependencies]
async-trait = "0.1.79"
aws-config = { version = "0.55.3", optional = true }
aws-sdk-kms = { version = "0.28.0", optional = true }
aws-sdk-s3 = { version = "0.28.0", optional = true }
aws-sdk-sesv2 = "0.28.0"
aws-sdk-sts = "0.28.0"
aws-smithy-client = "0.55.3"
aws-config = { version = "1.5.10", optional = true, features = ["behavior-version-latest"] }
aws-sdk-kms = { version = "1.51.0", optional = true }
aws-sdk-sesv2 = "1.57.0"
aws-sdk-sts = "1.51.0"
aws-sdk-s3 = { version = "1.65.0", optional = true }
aws-smithy-runtime = "1.8.0"
base64 = "0.22.0"
dyn-clone = "1.0.17"
error-stack = "0.4.1"

View File

@ -193,4 +193,8 @@ pub enum EmailError {
/// The expected feature is not implemented
#[error("Feature not implemented")]
NotImplemented,
/// An error occurred when building email content.
#[error("Error building email content")]
ContentBuildFailure,
}

View File

@ -7,6 +7,7 @@ use aws_sdk_sesv2::{
Client,
};
use aws_sdk_sts::config::Credentials;
use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
use common_utils::{errors::CustomResult, pii};
use error_stack::{report, ResultExt};
use hyper::Uri;
@ -53,7 +54,7 @@ impl SESConfig {
pub enum AwsSesError {
/// An error occurred in the SDK while sending email.
#[error("Failed to Send Email {0:?}")]
SendingFailure(aws_smithy_client::SdkError<SendEmailError>),
SendingFailure(aws_sdk_sesv2::error::SdkError<SendEmailError>),
/// Configuration variable is missing to construct the email client
#[error("Missing configuration variable {0}")]
@ -131,29 +132,13 @@ impl AwsSes {
)?;
let credentials = Credentials::new(
creds
.access_key_id()
.ok_or(
report!(AwsSesError::TemporaryCredentialsMissing(format!(
"{role:?}"
)))
.attach_printable("Access Key ID not found"),
)?
.to_owned(),
creds
.secret_access_key()
.ok_or(
report!(AwsSesError::TemporaryCredentialsMissing(format!(
"{role:?}"
)))
.attach_printable("Secret Access Key not found"),
)?
.to_owned(),
creds.session_token().map(|s| s.to_owned()),
creds.expiration().and_then(|dt| {
SystemTime::UNIX_EPOCH
.checked_add(Duration::from_nanos(u64::try_from(dt.as_nanos()).ok()?))
}),
creds.access_key_id(),
creds.secret_access_key(),
Some(creds.session_token().to_owned()),
u64::try_from(creds.expiration().as_nanos())
.ok()
.map(Duration::from_nanos)
.and_then(|val| SystemTime::UNIX_EPOCH.checked_add(val)),
"custom_provider",
);
@ -176,15 +161,11 @@ impl AwsSes {
) -> CustomResult<aws_config::ConfigLoader, AwsSesError> {
let region_provider = Region::new(region);
let mut config = aws_config::from_env().region(region_provider);
if let Some(proxy_url) = proxy_url {
let proxy_connector = Self::get_proxy_connector(proxy_url)?;
let provider_config = aws_config::provider_config::ProviderConfig::default()
.with_tcp_connector(proxy_connector.clone());
let http_connector =
aws_smithy_client::hyper_ext::Adapter::builder().build(proxy_connector);
config = config
.configure(provider_config)
.http_connector(http_connector);
let http_client = HyperClientBuilder::new().build(proxy_connector);
config = config.http_client(http_client);
};
Ok(config)
}
@ -218,7 +199,8 @@ impl EmailClient for AwsSes {
Content::builder()
.data(intermediate_string.into_inner())
.charset("UTF-8")
.build(),
.build()
.change_context(EmailError::ContentBuildFailure)?,
)
.build();
@ -250,7 +232,12 @@ impl EmailClient for AwsSes {
EmailContent::builder()
.simple(
Message::builder()
.subject(Content::builder().data(subject).build())
.subject(
Content::builder()
.data(subject)
.build()
.change_context(EmailError::ContentBuildFailure)?,
)
.body(body)
.build(),
)

View File

@ -142,15 +142,15 @@ impl FileStorageInterface for AwsFileStorageClient {
enum AwsS3StorageError {
/// Error indicating that file upload to S3 failed.
#[error("File upload to S3 failed: {0:?}")]
UploadFailure(aws_smithy_client::SdkError<PutObjectError>),
UploadFailure(aws_sdk_s3::error::SdkError<PutObjectError>),
/// Error indicating that file retrieval from S3 failed.
#[error("File retrieve from S3 failed: {0:?}")]
RetrieveFailure(aws_smithy_client::SdkError<GetObjectError>),
RetrieveFailure(aws_sdk_s3::error::SdkError<GetObjectError>),
/// Error indicating that file deletion from S3 failed.
#[error("File delete from S3 failed: {0:?}")]
DeleteFailure(aws_smithy_client::SdkError<DeleteObjectError>),
DeleteFailure(aws_sdk_s3::error::SdkError<DeleteObjectError>),
/// Unknown error occurred.
#[error("Unknown error occurred: {0:?}")]