Describe the bug
Amazon.Lambda.DurableExecution matches the stale checkpoint token rejection with a case-sensitive prefix check against "Invalid Checkpoint Token". The service emits "Invalid checkpoint token" (lowercase c and t). The check never matches, so a stale token is treated as a terminal 4xx and the whole durable execution fails instead of just the invocation.
Regression Issue
Expected Behavior
When the service rejects a checkpoint call with InvalidParameterValueException because the checkpoint token is stale (a newer invocation superseded this one), IsTerminalCheckpointError returns false. The exception escapes to the host, Lambda retries the invocation, the service issues a fresh token, and the execution continues.
Current Behavior
IsTerminalCheckpointError returns true. The catch in DurableFunction.FunctionHandlerAsync returns Status = InvocationStatus.Failed. The execution is failed every time a stale token is seen.
Root cause, in Libraries/src/Amazon.Lambda.DurableExecution/DurableFunction.cs:
|
if (ex.ErrorCode == "InvalidParameterValueException" |
|
&& ex.Message != null |
|
&& ex.Message.StartsWith("Invalid Checkpoint Token", StringComparison.Ordinal)) |
|
{ |
|
return false; |
|
} |
if (ex.ErrorCode == "InvalidParameterValueException"
&& ex.Message != null
&& ex.Message.StartsWith("Invalid Checkpoint Token", StringComparison.Ordinal))
{
return false;
}
The service constant (ValidationErrorMessages.INVALID_CHECKPOINT_TOKEN, internal) is "Invalid checkpoint token".
The existing test uses the SDK's string rather than the service's, so it cannot catch this:
|
new object[] { MakeServiceException("InvalidParameterValueException", HttpStatusCode.BadRequest, "Invalid Checkpoint Token: stale") }, |
Reproduction Steps
- Construct an
AmazonServiceException with ErrorCode = "InvalidParameterValueException", StatusCode = 400, and message "Invalid checkpoint token: ..." (the real service message).
- Call
IsTerminalCheckpointError with it (or run a workflow whose checkpoint flush throws it).
- Observe it returns
true and the invocation output is Failed.
Possible Solution
- Change the literal to
"Invalid checkpoint token", or use StringComparison.OrdinalIgnoreCase to protect against future drift.
- Update
DurableFunctionTests to use the real service message.
Additional Information/Context
The same defect exists in the JS, Python, Java, Rust, and Go durable execution SDKs; each has its own issue. Links are in a comment below.
AWS .NET SDK and/or Package version used
Amazon.Lambda.DurableExecution 2.0.0 (master at 8ed93ce)
Targeted .NET Platform
Any
Operating System and version
Any
Describe the bug
Amazon.Lambda.DurableExecutionmatches the stale checkpoint token rejection with a case-sensitive prefix check against"Invalid Checkpoint Token". The service emits"Invalid checkpoint token"(lowercasecandt). The check never matches, so a stale token is treated as a terminal 4xx and the whole durable execution fails instead of just the invocation.Regression Issue
Expected Behavior
When the service rejects a checkpoint call with
InvalidParameterValueExceptionbecause the checkpoint token is stale (a newer invocation superseded this one),IsTerminalCheckpointErrorreturnsfalse. The exception escapes to the host, Lambda retries the invocation, the service issues a fresh token, and the execution continues.Current Behavior
IsTerminalCheckpointErrorreturnstrue. The catch inDurableFunction.FunctionHandlerAsyncreturnsStatus = InvocationStatus.Failed. The execution is failed every time a stale token is seen.Root cause, in
Libraries/src/Amazon.Lambda.DurableExecution/DurableFunction.cs:aws-lambda-dotnet/Libraries/src/Amazon.Lambda.DurableExecution/DurableFunction.cs
Lines 202 to 207 in 8ed93ce
The service constant (
ValidationErrorMessages.INVALID_CHECKPOINT_TOKEN, internal) is"Invalid checkpoint token".The existing test uses the SDK's string rather than the service's, so it cannot catch this:
aws-lambda-dotnet/Libraries/test/Amazon.Lambda.DurableExecution.Tests/DurableFunctionTests.cs
Line 488 in 8ed93ce
Reproduction Steps
AmazonServiceExceptionwithErrorCode = "InvalidParameterValueException",StatusCode = 400, and message"Invalid checkpoint token: ..."(the real service message).IsTerminalCheckpointErrorwith it (or run a workflow whose checkpoint flush throws it).trueand the invocation output isFailed.Possible Solution
"Invalid checkpoint token", or useStringComparison.OrdinalIgnoreCaseto protect against future drift.DurableFunctionTeststo use the real service message.Additional Information/Context
The same defect exists in the JS, Python, Java, Rust, and Go durable execution SDKs; each has its own issue. Links are in a comment below.
AWS .NET SDK and/or Package version used
Amazon.Lambda.DurableExecution 2.0.0 (master at 8ed93ce)
Targeted .NET Platform
Any
Operating System and version
Any