brendanhay / amazonka

A comprehensive Amazon Web Services SDK for Haskell.
https://amazonka.brendanhay.nz
Other
599 stars 227 forks source link

DynamoDB ProvisionedThroughputExceeded Not Caught #849

Closed RobertFischer closed 1 year ago

RobertFischer commented 1 year ago

Looks like the DynamoDB defaultService is configured improperly for retrying when ProvisionedThroughputExceeded occurs -- the current implementation is looking for "ProvisionedThroughputExceededException", but it's a more generic ServiceError that's being thrown.

"err":"ServiceError (ServiceError' {_serviceErrorAbbrev = Abbrev {fromAbbrev = \"DynamoDB\"}, _serviceErrorStatus = Status {statusCode = 400, statusMessage = \"Bad Request\"}, _serviceErrorHeaders = [(\"Server\",\"Server\"),(\"Date\",\"Thu, 01 Dec 2022 21:42:39 GMT\"),(\"Content-Type\",\"application/x-amz-json-1.0\"),(\"Content-Length\",\"241\"),(\"Connection\",\"keep-alive\"),(\"x-amzn-RequestId\",\"8KRS15P5JUD29RHDVEK26MAU1VVV4KQNSO5AEMVJF66Q9ASUAAJG\"),(\"x-amz-crc32\",\"1545824508\")], _serviceErrorCode = ErrorCode \"ProvisionedThroughputExceeded\", _serviceErrorMessage = Just (ErrorMessage {fromErrorMessage = \"The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.\"}), _serviceErrorRequestId = Just (RequestId {fromRequestId = \"8KRS15P5JUD29RHDVEK26MAU1VVV4KQNSO5AEMVJF66Q9ASUAAJG\"})})"
RobertFischer commented 1 year ago

I'm happy to contribute a fix, but it's in generated code, and I'm not sure how that magic all works...

endgame commented 1 year ago

The fact that it's using the ServiceError constructor is not a problem — all error types do that. Can you please be more specific about what improper retries look like here? The corresponding error definition in botocore says that this error type will automatically retry:

https://github.com/boto/botocore/blob/ed72f826cb837e24693f540fc19c6e25ade75a95/botocore/data/dynamodb/2012-08-10/service-2.json#L4254

endgame commented 1 year ago

Closing due to lack of response. Please reopen if you have a reproducer.