[英]StepFunctionsLocal does not accept $$ parameter
As documented here , the AWS state machine definition syntax allows access to attributes from the higher scope within a map state iteration with $$.Map.Item.Value
:如此处所述,AWS state 机器定义语法允许使用
$$.Map.Item.Value
访问 map state 迭代中更高 scope 的属性:
{
"StartAt": "ExampleMapState",
"States": {
"ExampleMapState": {
"Type": "Map",
"Parameters": {
"ContextValue.$": "$$.Map.Item.Value"
},
"Iterator": {
"StartAt": "TestPass",
"States": {
"TestPass": {
"Type": "Pass",
"End": true
}
}
},
"End": true
}
}
}
However, when run with the StepFunctionsLocal (both Java and Docker versions) this example definition itself raises SCHEMA_VALIDATION_FAILED error:但是,当使用 StepFunctionsLocal(Java 和 Docker 版本)运行时,此示例定义本身会引发 SCHEMA_VALIDATION_FAILED 错误:
SCHEMA_VALIDATION_FAILED: The value for the field 'ContextValue.$' must be a valid JSONPath or a valid intrinsic function call at /States/ExampleMapState/Parameters
Am I missing something or is this a bug in the StepFunctionsLocal?我是否遗漏了什么或者这是 StepFunctionsLocal 中的错误?
检查您的脚本以确保您已正确转义双 $$
After some tests, my best guess is that it's a bug in the aws
cli (or a scaping issue when declaring the sfn definition, as stated here , though I wasn't able to do it).经过一些测试后,我最好的猜测是它是
aws
cli 中的一个错误(或者声明sfn定义时的一个转义问题,如此处所述,尽管我无法做到这一点)。
Anyway, I tried boto3
instead of the cli
using this example definition.无论如何,我使用这个示例定义尝试
boto3
而不是cli
。
>>> definition = """
... {
... "Comment": "Accessing context object in a state machine",
... "StartAt": "Get execution context data",
... "States": {
... "Get execution context data": {
... "Type": "Pass",
... "Parameters": {
... "startTime.$": "$$.Execution.StartTime",
... "execName.$": "$$.Execution.Name"
... },
... "ResultPath": "$.executionContext",
... "End": true
... }
... }
... }"""
>>> role = "arn:aws:iam::012345678901:role/DummyRole"
>>> r = client.create_state_machine(name="Test", definition=definition, roleArn=role)
>>> pprint.pprint(r)
{'ResponseMetadata': {'HTTPHeaders': {'content-length': '161',
'date': 'Fri, 30 Dec 2022 19:46:31 GMT',
'server': 'Jetty(9.4.43.v20210629)'},
'HTTPStatusCode': 200,
'RetryAttempts': 0},
'creationDate': datetime.datetime(2022, 12, 30, 14, 46, 31, 770000, tzinfo=tzlocal()),
'stateMachineArn': 'arn:aws:states:us-west-2:123456789012:stateMachine:Test'}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.