March 23rd, 2023
Pre-releaseBreaking Changes:
-
⚠🎉 (all, smithy-rs#2467) Update MSRV to 1.66.1
-
⚠ (client, smithy-rs#76, smithy-rs#2129) Generic clients no longer expose a
request_id()
function on errors. To get request ID functionality, use the SDK code generator. -
⚠ (client, smithy-rs#76, smithy-rs#2129) The
message()
andcode()
methods on errors have been moved intoProvideErrorMetadata
trait. This trait will need to be imported to continue calling these. -
⚠ (client, smithy-rs#76, smithy-rs#2129, smithy-rs#2075) The
*Error
and*ErrorKind
types have been combined to make error matching simpler.Example with S3
Before:
let result = client .get_object() .bucket(BUCKET_NAME) .key("some-key") .send() .await; match result { Ok(_output) => { /* Do something with the output */ } Err(err) => match err.into_service_error() { GetObjectError { kind, .. } => match kind { GetObjectErrorKind::InvalidObjectState(value) => println!("invalid object state: {:?}", value), GetObjectErrorKind::NoSuchKey(_) => println!("object didn't exist"), } err @ GetObjectError { .. } if err.code() == Some("SomeUnmodeledError") => {} err @ _ => return Err(err.into()), }, }
After:
// Needed to access the `.code()` function on the error type: use aws_sdk_s3::types::ProvideErrorMetadata; let result = client .get_object() .bucket(BUCKET_NAME) .key("some-key") .send() .await; match result { Ok(_output) => { /* Do something with the output */ } Err(err) => match err.into_service_error() { GetObjectError::InvalidObjectState(value) => { println!("invalid object state: {:?}", value); } GetObjectError::NoSuchKey(_) => { println!("object didn't exist"); } err if err.code() == Some("SomeUnmodeledError") => {} err @ _ => return Err(err.into()), }, }
-
⚠ (client, smithy-rs#76, smithy-rs#2129)
aws_smithy_types::Error
has been renamed toaws_smithy_types::error::ErrorMetadata
. -
⚠ (server, smithy-rs#2436) Remove unnecessary type parameter
B
fromUpgrade
service. -
🐛⚠ (server, smithy-rs#2382) Smithy members named
send
were previously renamed tosend_value
at codegen time. These will now be calledsend
in the generated code. -
⚠ (client, smithy-rs#2448) The modules in generated client crates have been reorganized. See the Client Crate Reorganization Upgrade Guidance to see how to fix your code after this change.
-
⚠ (server, smithy-rs#2438) Servers can send the
ServerRequestId
in the response headers.
Servers need to create their service using the new layer builderServerRequestIdProviderLayer::new_with_response_header
:let app = app .layer(&ServerRequestIdProviderLayer::new_with_response_header(HeaderName::from_static("x-request-id")));
New this release:
-
🐛🎉 (client, aws-sdk-rust#740) Fluent builder methods on the client are now marked as deprecated when the related operation is deprecated.
-
🎉 (all, smithy-rs#2398) Add support for the
awsQueryCompatible
trait. This allows services to continue supporting a custom error code (via theawsQueryError
trait) when the services migrate their protocol fromawsQuery
toawsJson1_0
annotated withawsQueryCompatible
.Click to expand for more details...
After the migration, services will include an additional header
x-amzn-query-error
in their responses whose value is in the form of<error code>;<error type>
. An example response looks something likeHTTP/1.1 400 x-amzn-query-error: AWS.SimpleQueueService.NonExistentQueue;Sender Date: Wed, 08 Sep 2021 23:46:52 GMT Content-Type: application/x-amz-json-1.0 Content-Length: 163 { "__type": "com.amazonaws.sqs#QueueDoesNotExist", "message": "some user-visible message" }
<error code>
isAWS.SimpleQueueService.NonExistentQueue
and<error type>
isSender
.If an operation results in an error that causes a service to send back the response above, you can access
<error code>
and<error type>
as follows:match client.some_operation().send().await { Ok(_) => { /* success */ } Err(sdk_err) => { let err = sdk_err.into_service_error(); assert_eq!( error.meta().code(), Some("AWS.SimpleQueueService.NonExistentQueue"), ); assert_eq!(error.meta().extra("type"), Some("Sender")); } } </details>
-
🎉 (client, smithy-rs#2428, smithy-rs#2208)
SdkError
variants can now be constructed for easier unit testing. -
🐛 (server, smithy-rs#2441) Fix
FilterByOperationName
plugin. This previous caused services with this applied to fail to compile due to mismatched bounds. -
(client, smithy-rs#2437, aws-sdk-rust#600) Add more client re-exports. Specifically, it re-exports
aws_smithy_http::body::SdkBody
,aws_smithy_http::byte_stream::error::Error
, andaws_smithy_http::operation::{Request, Response}
. -
🐛 (all, smithy-rs#2226) Fix bug in timestamp format resolution. Prior to this fix, the timestamp format may have been incorrect if set on the target instead of on the member.
-
(all, smithy-rs#2226) Add support for offsets when parsing datetimes. RFC3339 date times now support offsets like
-0200
-
(client, aws-sdk-rust#160, smithy-rs#2445) Reconnect on transient errors.
Note: this behavior is disabled by default for generic clients. It can be enabled with
aws_smithy_client::Builder::reconnect_on_transient_errors
If a transient error (timeout, 500, 503, 503) is encountered, the connection will be evicted from the pool and will not
be reused. -
(all, smithy-rs#2474) Increase Tokio version to 1.23.1 for all crates. This is to address RUSTSEC-2023-0001