Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
Fix/sqs bare name (#294)
Nahuel Nucera21b9285ccfb7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c09359a7..64c69730 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,24 +7,23 @@ Versioning follows [Semantic Versioning](https://semver.org/).----## [Unreleased]+## [1.2.8] — 2026-04-13-### Fixed-- **SFN query-protocol XML response fidelity** — `_xml_element_to_dict` now coerces known numeric fields to integers, boolean fields to booleans, and detects list-wrapper elements to produce JSON arrays even with a single child. Empty self-closing list wrappers return `[]` instead of `""`. Contributed by @jayjanssen.-### Added-- **RDS Data API SQL-aware stubs** — when no real database endpoint is available, `ExecuteStatement` now tracks `CREATE/DROP DATABASE`, `CREATE/DROP USER`, and `GRANT/REVOKE` statements in memory per cluster. Verification queries (`SELECT schema_name FROM information_schema.schemata`, `SELECT FROM mysql.user`, `SHOW GRANTS FOR`) return tracked state. Enables acceptance testing of database provisioning workflows without Docker-in-Docker. Connection errors also fall back to stubs instead of returning 400. Contributed by @jayjanssen.### Added-- **RDS parameter group persistence** — `ModifyDBParameterGroup` and `ModifyDBClusterParameterGroup` now store `ApplyMethod` alongside parameter values. `DescribeDBParameters` and `DescribeDBClusterParameters` return stored parameters with `Source` filter support (`user`, `engine-default`). Custom parameters beyond engine defaults are included.+- **SFN intrinsic functions batch 2** — `States.ArrayContains`, `States.ArrayUnique`, `States.ArrayPartition`, `States.ArrayRange`, `States.MathRandom`, `States.MathAdd`, `States.UUID`. Contributed by @jayjanssen (#289)+- **RDS Data API SQL-aware stubs** — when no real database endpoint is available, `ExecuteStatement` now tracks `CREATE/DROP DATABASE`, `CREATE/DROP USER`, and `GRANT/REVOKE` statements in memory per cluster. Verification queries return tracked state. Enables acceptance testing of database provisioning workflows without Docker-in-Docker. Contributed by @jayjanssen (#293)+- **RDS parameter group persistence** — `ModifyDBParameterGroup` and `ModifyDBClusterParameterGroup` now store `ApplyMethod` alongside parameter values. `DescribeDBParameters` and `DescribeDBClusterParameters` return stored parameters with `Source` filter support. Contributed by @jayjanssen (#292)+- **ELBv2 listener attributes** — `DescribeListenerAttributes` and `ModifyListenerAttributes` for ALB listeners. Contributed by @jgrumboe (#286)+- **EC2 subnet tag filtering** — `DescribeSubnets` now supports `tag:*` and `tag-key` filters. Contributed by @jgrumboe (#285)### Fixed-- **RDS `DescribeDBEngineVersions` family prefix** — `DBParameterGroupFamily` no longer double-prefixes the engine name (e.g. `aurora-mysqlaurora-mysql8.0` → `aurora-mysql8.0`). Contributed by @jayjanssen.+- **SQS bare queue name as QueueUrl** — passing a bare queue name (e.g. `my-queue`) instead of a full URL now resolves correctly, matching AWS and LocalStack behavior. Previously returned `QueueDoesNotExist`. Reported by @RSzynal-albot+- **Lambda ESM ReportBatchItemFailures** — SQS event source mappings with `FunctionResponseTypes=["ReportBatchItemFailures"]` now parse the handler's `batchItemFailures` response. Failed messages are left on the queue for redelivery/DLQ instead of being silently deleted. Reported by @okinaka+- **SFN REST-JSON PascalCase to camelCase conversion** — `_dispatch_aws_sdk_rest_json` now converts PascalCase parameter names to camelCase before dispatching. Fixes `BadRequestException: resourceArn is required` when Step Functions dispatches to RDS Data API. Contributed by @jayjanssen (#291)+- **SFN query-protocol XML response fidelity** — `_xml_element_to_dict` now coerces known numeric fields to integers, boolean fields to booleans, and detects list-wrapper elements to produce JSON arrays even with a single child. Contributed by @jayjanssen (#290)+- **RDS DescribeDBEngineVersions family prefix** — `DBParameterGroupFamily` no longer double-prefixes the engine name. Contributed by @jayjanssen (#292)----### Fixed-- **SFN REST-JSON PascalCase\u2192camelCase conversion** \u2014 `_dispatch_aws_sdk_rest_json` now converts PascalCase parameter names to camelCase before dispatching. Fixes `BadRequestException: resourceArn is required` when Step Functions dispatches to RDS Data API. Contributed by @jayjanssen.-### Added-- **SFN intrinsic functions batch 2** — `States.ArrayContains`, `States.ArrayUnique`, `States.ArrayPartition`, `States.ArrayRange`, `States.MathRandom`, `States.MathAdd`, `States.UUID`. Contributed by @jayjanssen.-## [1.2.7] — 2026-04-12diff --git a/ministack/app.py b/ministack/app.pyindex 55d011d9..17a83c08 100644--- a/ministack/app.py+++ b/ministack/app.py@@ -908,7 +908,26 @@ def main():signal.signal(signal.SIGTERM, lambda *_: (_cleanup(), sys.exit(0)))try:- uvicorn.run("ministack.app:app", host="0.0.0.0", port=port, log_level=LOG_LEVEL.lower(), timeout_keep_alive=75)+ # Suppress health-check access logs at INFO level (reported by @McDoit).+ # Visible when LOG_LEVEL=DEBUG.+ _HEALTH_PATHS = ("/_ministack/health", "/_localstack/health", "/health")++ class _HealthLogFilter(logging.Filter):+ def filter(self, record):+ if LOG_LEVEL == "DEBUG":+ return True+ msg = record.getMessage()+ return not any(p in msg for p in _HEALTH_PATHS)++ log_config = uvicorn.config.LOGGING_CONFIG.copy()+ log_config["loggers"] = log_config.get("loggers", {}).copy()+ log_config["filters"] = {"health_filter": {"()": lambda: _HealthLogFilter()}}+ access_logger = log_config["loggers"].get("uvicorn.access", {}).copy()+ access_logger["filters"] = ["health_filter"]+ log_config["loggers"]["uvicorn.access"] = access_logger++ uvicorn.run("ministack.app:app", host="0.0.0.0", port=port, log_level=LOG_LEVEL.lower(),+ timeout_keep_alive=75, log_config=log_config)finally:_cleanup()diff --git a/ministack/services/lambda_svc.py b/ministack/services/lambda_svc.pyindex 177dda1d..9dde3b9a 100644--- a/ministack/services/lambda_svc.py+++ b/ministack/services/lambda_svc.py@@ -2823,13 +2823,42 @@ def _poll_sqs():func_name, queue_name, err_type, err_msg, result.get("log", ""),)else:- receipt_handles = {msg["receipt_handle"] for msg in batch if msg.get("receipt_handle")}- _sqs._delete_messages_for_esm(queue_url, receipt_handles)- esm["LastProcessingResult"] = f"OK - {len(batch)} records"+ # Check for ReportBatchItemFailures — partial batch response+ failed_ids = set()+ if "ReportBatchItemFailures" in esm.get("FunctionResponseTypes", []):+ body = result.get("body")+ if isinstance(body, dict):+ for failure in body.get("batchItemFailures", []):+ fid = failure.get("itemIdentifier", "")+ if fid:+ failed_ids.add(fid)+ elif isinstance(body, str):+ try:+ parsed = json.loads(body)+ for failure in parsed.get("batchItemFailures", []):+ fid = failure.get("itemIdentifier", "")+ if fid:+ failed_ids.add(fid)+ except (json.JSONDecodeError, AttributeError):+ pass++ # Delete only the messages that succeeded (not in failed_ids)+ succeeded = [msg for msg in batch if msg["id"] not in failed_ids]+ receipt_handles = {msg["receipt_handle"] for msg in succeeded if msg.get("receipt_handle")}+ if receipt_handles:+ _sqs._delete_messages_for_esm(queue_url, receipt_handles)++ n_failed = len(batch) - len(succeeded)+ if n_failed:+ esm["LastProcessingResult"] = f"OK - {len(succeeded)} records, {n_failed} partial failures"+ logger.info("ESM: Lambda %s processed %d SQS messages from %s (%d partial failures)",+ func_name, len(succeeded), queue_name, n_failed)+ else:+ esm["LastProcessingResult"] = f"OK - {len(batch)} records"+ logger.info("ESM: Lambda %s processed %d SQS messages from %s", func_name, len(batch), queue_name)log_output = result.get("log", "")if log_output:logger.info("ESM: Lambda %s output:\n%s", func_name, log_output)- logger.info("ESM: Lambda %s processed %d SQS messages from %s", func_name, len(batch), queue_name)def _poll_kinesis():diff --git a/ministack/services/rds_data.py b/ministack/services/rds_data.pyindex 367b330d..26b3cb19 100644--- a/ministack/services/rds_data.py+++ b/ministack/services/rds_data.py@@ -23,9 +23,9 @@ _lock = threading.Lock()# In-memory tracking for stub mode: remember databases/users created via SQL.# Keyed by cluster identifier.-_stub_databases: dict = {} # cluster_id -> set of database names-_stub_users: dict = {} # cluster_id -> set of usernames-_stub_grants: dict = {} # cluster_id -> {username -> list of grant strings}+_stub_databases = AccountScopedDict() # cluster_id -> set of database names+_stub_users = AccountScopedDict() # cluster_id -> set of usernames+_stub_grants = AccountScopedDict() # cluster_id -> {username -> list of grant strings}def _error(code, message, status=400):diff --git a/ministack/services/sqs.py b/ministack/services/sqs.pyindex 82a82675..0a4e8fcd 100644--- a/ministack/services/sqs.py+++ b/ministack/services/sqs.py@@ -598,13 +598,13 @@ def _get_q(url: str) -> dict:if q is None:# Fallback: extract queue name from URL and look up by name.# This handles cases where the hostname differs (e.g. docker-compose- # service name "ministack" vs "localhost").+ # service name "ministack" vs "localhost"), or when a bare queue name+ # is passed instead of a full URL (supported by AWS and some SDKs).parts = url.rstrip("/").split("/")- if len(parts) >= 2:- name = parts[-1]- canonical_url = _queue_name_to_url.get(name)- if canonical_url:- q = _queues.get(canonical_url)+ name = parts[-1] if len(parts) >= 2 else url+ canonical_url = _queue_name_to_url.get(name)+ if canonical_url:+ q = _queues.get(canonical_url)if q is None:raise _Err("QueueDoesNotExist","The specified queue does not exist for this wsdl version.")diff --git a/ministack/services/stepfunctions.py b/ministack/services/stepfunctions.pyindex 7fb0a3a3..e8b8106c 100644--- a/ministack/services/stepfunctions.py+++ b/ministack/services/stepfunctions.py@@ -2373,7 +2373,7 @@ def _xml_element_to_dict(element):is_plural = (tag.endswith(child_tag_name + "s")or tag == child_tag_name + "s"- or tag.endswith("Ids") and child_tag_name == "Id"+ or (tag.endswith("Ids") and child_tag_name == "Id"))has_multiple = len(children) > 1if is_member or is_plural or has_multiple:diff --git a/pyproject.toml b/pyproject.tomlindex e0351af0..9bdad4ed 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "ministack"-version = "1.2.7"+version = "1.2.8"description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"readme = "README.md"license = { file = "LICENSE" }diff --git a/tests/test_lambda.py b/tests/test_lambda.pyindex e3b024de..e6462e9a 100644--- a/tests/test_lambda.py+++ b/tests/test_lambda.py@@ -371,6 +371,85 @@ def test_lambda_esm_sqs_failure_respects_visibility_timeout(lam, sqs):lam.delete_event_source_mapping(UUID=esm_uuid)++def test_lambda_esm_sqs_report_batch_item_failures(lam, sqs):+ """ReportBatchItemFailures: failed messages stay on queue and reach DLQ."""+ for fn in ("esm-partial-func",):+ try:+ lam.delete_function(FunctionName=fn)+ except Exception:+ pass++ # Handler reports ALL messages as failed+ code = (+ "import json\n"+ "def handler(event, context):\n"+ " failures = []\n"+ " for r in event.get('Records', []):\n"+ " failures.append({'itemIdentifier': r['messageId']})\n"+ " return {'batchItemFailures': failures}\n"+ )+ lam.create_function(+ FunctionName="esm-partial-func",+ Runtime="python3.9",+ Role=_LAMBDA_ROLE,+ Handler="index.handler",+ Code={"ZipFile": _make_zip(code)},+ )++ # DLQ + main queue with maxReceiveCount=1+ dlq_url = sqs.create_queue(QueueName="esm-partial-dlq")["QueueUrl"]+ dlq_arn = sqs.get_queue_attributes(+ QueueUrl=dlq_url, AttributeNames=["QueueArn"]+ )["Attributes"]["QueueArn"]++ q_url = sqs.create_queue(+ QueueName="esm-partial-queue",+ Attributes={+ "VisibilityTimeout": "1",+ "RedrivePolicy": json.dumps({+ "deadLetterTargetArn": dlq_arn,+ "maxReceiveCount": "1",+ }),+ },+ )["QueueUrl"]+ q_arn = sqs.get_queue_attributes(+ QueueUrl=q_url, AttributeNames=["QueueArn"]+ )["Attributes"]["QueueArn"]++ esm = lam.create_event_source_mapping(+ EventSourceArn=q_arn,+ FunctionName="esm-partial-func",+ FunctionResponseTypes=["ReportBatchItemFailures"],+ BatchSize=1,+ Enabled=True,+ )+ esm_uuid = esm["UUID"]+ assert "ReportBatchItemFailures" in esm["FunctionResponseTypes"]++ sqs.send_message(QueueUrl=q_url, MessageBody="partial-fail-test")++ # Wait for ESM to process and message to land in DLQ+ dlq_count = 0+ for _ in range(30):+ time.sleep(1)+ attrs = sqs.get_queue_attributes(+ QueueUrl=dlq_url,+ AttributeNames=["ApproximateNumberOfMessages"],+ )+ dlq_count = int(attrs["Attributes"]["ApproximateNumberOfMessages"])+ if dlq_count >= 1:+ break++ lam.update_event_source_mapping(UUID=esm_uuid, Enabled=False)+ lam.delete_event_source_mapping(UUID=esm_uuid)++ assert dlq_count >= 1, (+ f"Message should have reached DLQ after partial failure, "+ f"but DLQ has {dlq_count} messages"+ )++def test_lambda_warm_start(lam, apigw):"""Warm worker via API Gateway execute-api: module-level state persists across invocations."""import urllib.request as _urlreqdiff --git a/tests/test_sqs.py b/tests/test_sqs.pyindex d99106c7..6b8a3220 100644--- a/tests/test_sqs.py+++ b/tests/test_sqs.py@@ -491,3 +491,25 @@ def test_sqs_event_source_mapping_to_lambda(lam, sqs):# Cleanuplam.delete_event_source_mapping(UUID=esm["UUID"])+++def test_sqs_bare_queue_name_as_url(sqs):+ """Passing a bare queue name instead of a full URL should work (AWS compatibility)."""+ queue_name = "intg-sqs-bare-name"+ sqs.create_queue(QueueName=queue_name)++ # Send using full URL (normal)+ url = sqs.get_queue_url(QueueName=queue_name)["QueueUrl"]+ sqs.send_message(QueueUrl=url, MessageBody="via-url")++ # Send using bare queue name instead of full URL+ sqs.send_message(QueueUrl=queue_name, MessageBody="via-name")++ # Both messages should be receivable+ msgs = []+ for _ in range(2):+ resp = sqs.receive_message(QueueUrl=queue_name, MaxNumberOfMessages=10)+ msgs.extend(resp.get("Messages", []))+ assert len(msgs) == 2+ bodies = sorted(m["Body"] for m in msgs)+ assert bodies == ["via-name", "via-url"]