Skip to content

Commit cfbd070

Browse files
authored
fix(sdk): dont fail invocations on throttling exceptions (#300)
We shouldn't be failing executions on throttling exceptions.
1 parent 0bbf07a commit cfbd070

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

packages/aws-durable-execution-sdk-js/src/utils/checkpoint/checkpoint-error-classification.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ describe("Checkpoint Error Classification", () => {
5454
expect(result.message).toContain("Invalid parameter value");
5555
});
5656

57+
it("should classify 429 errors as invocation error (retryable)", () => {
58+
const awsError = {
59+
name: "TooManyRequestsException",
60+
message: "Rate limit exceeded",
61+
$metadata: { httpStatusCode: 429 },
62+
};
63+
64+
const result = (handler as any).classifyCheckpointError(awsError);
65+
66+
expect(result).toBeInstanceOf(CheckpointUnrecoverableInvocationError);
67+
expect(result.message).toContain("Rate limit exceeded");
68+
});
69+
5770
it("should classify 4xx InvalidParameterValueException without Invalid Checkpoint Token as execution error", () => {
5871
const awsError = {
5972
name: "InvalidParameterValueException",

packages/aws-durable-execution-sdk-js/src/utils/checkpoint/checkpoint.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,13 @@ class CheckpointHandler {
239239
);
240240
}
241241

242-
// Other 4xx errors
243-
if (statusCode && statusCode >= 400 && statusCode < 500) {
242+
// Non-retryable errors (4xx except 429)
243+
if (
244+
statusCode &&
245+
statusCode >= 400 &&
246+
statusCode < 500 &&
247+
statusCode !== 429
248+
) {
244249
return new CheckpointUnrecoverableExecutionError(
245250
`Checkpoint failed: ${errorMessage}`,
246251
originalError,

0 commit comments

Comments
 (0)