Repository navigation
Bug: payload_validation_jmespath ignores jmespath_options, so powertools_json() raises Unknown function #8473
Description
Expected Behaviour
payload_validation_jmespath should accept the same JMESPath functions as event_key_jmespath. The idempotency docs say powertools_json, powertools_base64 and powertools_base64_gzip "are also available to use in this utility".
With the snippet below the handler should run and return {"statusCode": 200, "body": "charged"}. A later call with the same order_id and a changed amount should raise IdempotencyValidationError.
Current Behaviour
Every call fails before the handler runs. What I get:
aws_lambda_powertools.utilities.idempotency.exceptions.IdempotencyPersistenceLayerError: Failed to save in progress record to idempotency store - (Unknown function: powertools_json())
This hits API Gateway handlers, where the payload is a JSON string in body. The docs use powertools_json(body) for the idempotency key, and payload validation is how you catch a changed amount. Use both and no request gets through.
Only the key search passes jmespath_options:
powertools-lambda-python/aws_lambda_powertools/utilities/idempotency/persistence/base.py
Lines 114 to 117 in f872ab8
| data = self.event_key_compiled_jmespath.search( | |
| data, | |
| options=jmespath.Options(**(self.jmespath_options or {})), | |
| ) |
The payload search doesn't pass any options, so neither the Powertools functions nor custom functions from jmespath_options exist there:
powertools-lambda-python/aws_lambda_powertools/utilities/idempotency/persistence/base.py
Line 160 in f872ab8
| data = self.validation_key_jmespath.search(data) |
Code snippet
import json
from aws_lambda_powertools.utilities.idempotency import (
DynamoDBPersistenceLayer,
IdempotencyConfig,
idempotent,
)
persistence_layer = DynamoDBPersistenceLayer(table_name="IdempotencyTable")
config = IdempotencyConfig(
event_key_jmespath="powertools_json(body).order_id",
payload_validation_jmespath="powertools_json(body).amount",
)
@idempotent(config=config, persistence_store=persistence_layer)
def lambda_handler(event, context):
return {"statusCode": 200, "body": "charged"}
lambda_handler({"body": json.dumps({"order_id": "o-1", "amount": 100})}, None)Possible Solution
Pass the same options in _get_hashed_payload:
data = self.validation_key_jmespath.search(
data,
options=jmespath.Options(**(self.jmespath_options or {})),
)I've got the fix with functional tests and will open a PR.
Steps to Reproduce
Run the snippet on develop (f872ab8) with an AWS region set. It fails while hashing the payload, before any DynamoDB call, so you don't need a table or credentials. v3.35.0 has the same line.
Powertools for AWS Lambda (Python) version
3.35.0
AWS Lambda function runtime
3.13
Packaging format used
PyPi
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsComing soon
Activity
boring-cyborg commentedon Sep 18, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
powertools-for-aws-oss-automation commentedon Sep 18, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
powertools-for-aws-oss-automation commentedon Sep 28, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Oct 15, 2026
This is now released under 3.36.0 version!