gpt4 book ai didi

aws-cloudformation - 如何设置api网关集成来调用step函数?

转载 作者:行者123 更新时间:2023-12-03 07:22:05 25 4
gpt4 key购买 nike

我正在尝试调用步骤函数并从请求路径传递输入“id”。当我调用它时,我收到消息

"errorMessage": "Unable to resolve property Input from source {\"id\":\"$request.path.id\"}. Please make sure that the request to API Gateway contains all the necessary fields specified in request parameters.",

如何指定输入值?

Type: AWS::ApiGatewayV2::Integration
DependsOn:
- ApiGatewayHTTP
- MyStateMachine
Properties:
ApiId: !Ref 'ApiGatewayHTTP'
IntegrationType: AWS_PROXY
IntegrationSubtype: StepFunctions-StartSyncExecution
CredentialsArn: !GetAtt MyStateMachineExecutionRole.Arn
RequestParameters:
StateMachineArn: !GetAtt 'MyStateMachine.Arn'
Input: '{"id":"$request.path.id"}'
ConnectionType: INTERNET
PayloadFormatVersion: 1.0
TimeoutInMillis: 3000

最佳答案

在上面的集成中,正确的语法是

  RequestParameters:
StateMachineArn: !GetAtt 'MyStateMachine.Arn'
Input: "{\"id\":$request.path.id}"

但是,如果路径参数是 Guid 或字符串,则这不起作用。例如,不能仅通过 POST 调用(例如 POST https://some.com/0943fsre300)来调用它,因为它会抛出错误,您必须将路径中的参数包装到引号中 https://some.com/"0943fsre300",您还可以对引号进行编码。经过与 AWS 支持人员的无休止的反复沟通后,他们承认这是一个已知问题,并且他们正在努力修复。

关于aws-cloudformation - 如何设置api网关集成来调用step函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76343590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com