This repository was archived by the owner on Mar 23, 2026. It is now read-only.
StepFunctions: Fix ErrorName Value for Lambda Task Errors#11957
Merged
StepFunctions: Fix ErrorName Value for Lambda Task Errors#11957
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 34m 58s ⏱️ - 1h 16m 1s Results for commit 70b8455. ± Comparison against base commit 892eb4d. This pull request removes 2511 and adds 2 tests. Note that renamed tests count towards both. |
gregfurman
approved these changes
Nov 29, 2024
Contributor
gregfurman
left a comment
There was a problem hiding this comment.
LGTM! Nothing that can't be done in a follow-uo
| ) | ||
|
|
||
| @markers.aws.validated | ||
| def test_raise_custom_exception( |
Contributor
There was a problem hiding this comment.
Should we add a JSONata test to this as well in a follow-up? Curious if the $states.errorOutput works here too.
Comment on lines
+66
to
+78
| if isinstance(ex, ClientError): | ||
| error_name = CustomErrorName(error) | ||
| cause = ex.response["Error"]["Message"] | ||
| elif isinstance(ex, lambda_eval_utils.LambdaFunctionErrorException): | ||
| cause = ex.payload | ||
| elif isinstance(ex, ClientError): | ||
| try: | ||
| cause_object = json.loads(cause) | ||
| error = cause_object["errorType"] | ||
| except Exception as ex: | ||
| LOG.warning( | ||
| "Could not retrieve 'errorType' field from LambdaFunctionErrorException object: %s", | ||
| ex, | ||
| ) |
Contributor
There was a problem hiding this comment.
nit: Could be worth unifying this function and the above to prevent duplication in both the StateTaskLambda and StateTaskServiceLambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, the SFN v2 interpreter incorrectly assigns the error name "Exception" to Lambda task failures that result in a LambdaFunctionErrorException, rather than utilising the exception's errorType value. This limitation prevents users from catching or retrying Lambda task failures using custom exception values, as reported in this issue. These changes address the error name computation, correcting the behaviour, and introduce relevant tests for both legacy Lambda invocations and service task Lambda invocations.
Changes