Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

fix(lambda): return throttle retryAfterSeconds as a string (#1996)

Antonie Popovicade0bf719b30
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ab1cefa..169a518c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ Versioning follows [Semantic Versioning](https://semver.org/).
### Fixed
+- **Lambda — throttle `retryAfterSeconds` is a string** — a `TooManyRequestsException` returns `retryAfterSeconds` as a string, as the Lambda API model declares, so SDK clients such as the AWS SDK for Rust parse the response as a throttle.
+- **Step Functions — `States.TaskFailed` no longer matches `States.Timeout`** — a `Retry` or `Catch` on `States.TaskFailed` also matched a timeout, so a state machine retried or caught a timeout where AWS does not. `States.TaskFailed` now matches every error except `States.Timeout`, as the Step Functions error handling guide describes.
- **AppConfig — predefined deployment strategies** — `AppConfig.AllAtOnce`, `AppConfig.Linear50PercentEvery30Seconds`, `AppConfig.Canary10Percent20Minutes` and `AppConfig.Linear20PercentEvery6Minutes` now exist in every account and region and cannot be updated or deleted, as on AWS. A deployment records its strategy's parameters, and `StartDeployment` and `AWS::AppConfig::Deployment` fail with `ResourceNotFoundException` for a strategy that does not exist, where they used to accept any id. Contributed by @koh-sh.
- **RDS — standalone deletion protection and snapshot-tag settings apply immediately** — `ModifyDBInstance` now applies `DeletionProtection` and `CopyTagsToSnapshot` regardless of `ApplyImmediately`, returning the active values without adding these fields to `PendingModifiedValues`. Omitted settings keep their existing values.
- **OpenSearch — data-plane containers are named per account** — a domain's container was named `ministack-opensearch-<region>-<domain>`, so a second account creating a domain of the same name (including an account on another MiniStack sharing the Docker daemon) failed with a Docker name conflict, and the failed create's cleanup removed containers by that name. The names now carry an account and region hash, as RDS's do. Contributed by @skialpine.
diff --git a/ministack/services/lambda_svc.py b/ministack/services/lambda_svc.py
index d876f35c..162d2c5f 100644
--- a/ministack/services/lambda_svc.py
+++ b/ministack/services/lambda_svc.py
@@ -3802,7 +3802,7 @@ def _throttle_response(reason_code: str, msg: str, retry_after: int = 1) -> dict
"__type": "TooManyRequestsException",
"message": msg,
"Reason": reason_code,
- "retryAfterSeconds": retry_after,
+ "retryAfterSeconds": str(retry_after),
},
"error": True,
"log": "",
diff --git a/tests/test_lambda.py b/tests/test_lambda.py
index 59c0fe5d..bb9dbee6 100644
--- a/tests/test_lambda.py
+++ b/tests/test_lambda.py
@@ -6875,7 +6875,7 @@ def test_throttle_response_shape_matches_aws():
body = r["body"]
assert body["__type"] == "TooManyRequestsException"
assert body["Reason"] == "ReservedFunctionConcurrentInvocationLimitExceeded"
- assert "retryAfterSeconds" in body
+ assert body["retryAfterSeconds"] == "1" # a string in the Lambda API model, not an int
assert "message" in body