-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
stepfunctions-tasks: Cannot use fromJsonPathAt when passing arg array values to ScriptBootstrapActionConfigProperty #29299
Comments
|
I see this token is being mapped here: aws-cdk/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/private/cluster-utils.ts Lines 313 to 326 in a7de7fe
|
+1 I am experiencing the same issue |
@anthonysgro I wasn't able to reproduce this error with the following stack, it deployed successfully for me: const myTask = new sfn.Pass(this, 'FormatBootstrapArgs', {
parameters: {
'payload.$': '$.payload',
'bootstrapArgs.$': `States.Array(
'string_literal',
'com.example.spark.jobs.ProcessData',
$.payload.customValueFromPayload
)`,
}
}
).next(
new tasks.EmrCreateCluster(this, 'CreateEmrCluster', {
name: 'ClusterName',
releaseLabel: 'emr-7.0.0',
instances: {
masterInstanceType: 'm5.xlarge',
instanceCount: 2,
},
bootstrapActions:[
{
name: 'MyBootstrapAction',
scriptBootstrapAction: {
path: 'my_path',
args: sfn.TaskInput.fromJsonPathAt('$.bootstrapArgs').value
},
},
]
})) Could you provide another example of the stack that failed for you with the missing parameters filled in or let me know if there is some major difference with mine that mightve caused me to not run into the same error? |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
I will also try to reproduce in a small/minimal example. |
Are you able to provide a full mini example that we can deploy and reproduce this issue? |
Describe the bug
When writing step functions, often I want to pass a value from the payload to an API that expects an array value like this:
or
This works for EmrAddStepsProps
args
property, but not for the args property withinScriptBootstrapActionConfigProperty
. This means I cannot pass custom arguments based on my payload to bootstrap arguments when creating clusters, and this behavior seems contradictory to other tasks I have used in the library.Expected Behavior
I expected that I could dynamically pass a payload value to the
args
property withinScriptBootstrapActionConfigProperty
inside ofEmrCreateClusterProps
. This should correspond to the task in the Step Functions console having an "Args.$" key instead of "Args". However, I cannot do this via CDK. I can do this via manual cloudformation and editing in the console, so this seems to be a CDK limitation.Current Behavior
Instead, it fails:
Reproduction Steps
In CDK, I have done this before with the following design pattern successfully:
If you notice, in
EmrAddStepProps
, args is expected to be an array, but allows this as is receiving this array from the input of the payload.However, this does not work for the EmrCreateCluster api, specifically for the
args
property inScriptBootstrapActionConfigProperty
. Here is an example that fails to build:I can actually bypass this error when doing:
But then the Args parameter is dropped on synthesis and it doesn't get published to the AWS account
Possible Solution
It seems that sfn.TaskInput.fromJsonPathAt creates a resolvable token that is a string under the hood. However, CDK is still trying to map over this token which is incorrect behavior. I think that a possible fix could be to ignore this mapping behavior on resolvable tokens.
No response
Additional Information/Context
No response
CDK CLI Version
2.126.0
Framework Version
No response
Node.js Version
v18.19.1
OS
Sonoma 14.3.1
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: