fix(aws-stepfunctions): apply timeout to FileDefinitionBody and StringDefinitionBody#37602
Open
Sagargupta16 wants to merge 1 commit intoaws:mainfrom
Open
fix(aws-stepfunctions): apply timeout to FileDefinitionBody and StringDefinitionBody#37602Sagargupta16 wants to merge 1 commit intoaws:mainfrom
Sagargupta16 wants to merge 1 commit intoaws:mainfrom
Conversation
…gDefinitionBody The timeout property was only applied when using ChainDefinitionBody. FileDefinitionBody and StringDefinitionBody silently ignored it, causing unexpected behavior for users providing .asl.json or string definitions. Now both definition body types parse the ASL JSON and inject TimeoutSeconds when the timeout prop is specified. FileDefinitionBody falls back to definitionString (instead of S3 upload) when timeout is set so the injected value is included. Fixes aws#37150
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue # (if applicable)
Closes #37150.
Reason for this change
The
timeoutproperty onStateMachineonly applies when the definition body is aChainDefinitionBody. When users provide an ASL JSON file viaFileDefinitionBodyor an inline JSON string viaStringDefinitionBody, thetimeoutis silently ignored. This is unexpected and undocumented.Description of changes
Modified
FileDefinitionBody.bind()andStringDefinitionBody.bind()to injectTimeoutSecondsinto the ASL definition JSON whensfnProps.timeoutis specified.For
FileDefinitionBody: when a timeout is set, the file is read, parsed as JSON,TimeoutSecondsis added, and the result is returned as adefinitionString(bypassing the S3 asset upload, since the definition needs modification). Without a timeout, behavior is unchanged (S3 asset upload).For
StringDefinitionBody: when a timeout is set, the JSON string is parsed,TimeoutSecondsis added, and the modified JSON is returned. Without a timeout, behavior is unchanged.Describe any new or updated permissions being added
No permission changes.
Description of how you validated changes
Added three unit tests:
timeout is applied to StringDefinitionBody- verifies TimeoutSeconds is injected into inline JSON definitionstimeout is applied to FileDefinitionBody- verifies TimeoutSeconds is injected when definition comes from an ASL JSON fileStringDefinitionBody without timeout does not inject TimeoutSeconds- verifies no mutation when timeout is not specifiedChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license