Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: JSON Reference Path Error in AWS Step Functions Distributed Map #1822

Merged
merged 1 commit into from
May 3, 2024

Conversation

nidhinnru
Copy link
Contributor

Since April 30th, 2024, I've encountered a recurring error when creating/updating a state machine for Metaflow orchestration, particularly under the --use-distributed-map functionality. Recent changes to AWS API validation for state machine definitions have introduced more stringent checks before a state machine is created, as detailed in the AWS changelog.

The issue stems from the item_reader component improperly parsing JSON parameters due to a syntax error in the specified JSON Key path. This problem was not previously detected because there were no ValidateStateMachineDefinition checks in place. The original line causing the error in JSON was:

.parameter("Key.$", "$.Body.ResultFiles.SUCCEEDED.[0].Key")

To work around this issue, I modified the JSON path by removing the extra period before the array index, updating it to: .parameter("Key.$", "$.Body.ResultFiles.SUCCEEDED[0].Key")

This correction aligns with AWS's expected JSON path syntax and has resolved the error previously encountered during state machine creation. This change was tested by generating JSON definition using the --with retry step-functions create --use-distributed-map --only-json command, manually adjusted the JSON as needed, and subsequently using the AWS CLI for state machine creation.

Original Error:
Bootstrapping virtual environment(s) ... Virtual environment(s) bootstrapped! AWS Step Functions error: InvalidDefinition("An error occurred (InvalidDefinition) when calling the CreateStateMachine operation: Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: The value must be a valid Reference Path or a valid intrinsic function call at /States/review_videos_Map/ItemReader/Parameters/Key.$'")

Impact:
This fix ensures compatibility with AWS's updated validation requirements and prevents the InvalidDefinition error, which was thrown due to incorrect JSON Key path syntax which were previously allowed by AWS.

Fix:
Updated reference path as per https://states-language.net/#ref-paths.

@nidhinnru nidhinnru changed the title Fix: JSON Reference Path Error in ItemReader for AWS Step Functions Distributed Map Fix: JSON Reference Path Error in AWS Step Functions Distributed Map May 3, 2024
@nidhinnru nidhinnru marked this pull request as ready for review May 3, 2024 15:52
@savingoyal savingoyal merged commit 4292ade into Netflix:master May 3, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants