简体   繁体   English

API网关正在覆盖AWS步骤功能状态输出

[英]API Gateway is Overwriting AWS Step Functions State Output

I am following this article to implement a manual approval step for my state machine: 我正在关注本文,以为我的状态机实施手动批准步骤:

https://aws.amazon.com/blogs/compute/implementing-serverless-manual-approval-steps-in-aws-step-functions-and-amazon-api-gateway/ https://aws.amazon.com/blogs/compute/implementing-serverless-manual-approval-steps-in-aws-step-functions-and-amazon-api-gateway/

Here is the workflow: 这是工作流程:

-execution starts with a JSON input. -execution从JSON输入开始。 Something like {"instance-id":"i-xxxxxxx","action":"stop"}. 类似于{“ instance-id”:“ i-xxxxxxx”,“ action”:“ stop”}之类的东西。 The input is passed to the manual step 输入传递到手动步骤

-a lambda worker polls for activity tasks by calling GetActivityTask using the ARN of the manual step -a lambda worker通过使用手动步骤的ARN调用GetActivityTask来轮询活动任务

-work is vended back to the worker with a token -工作被带回令牌出售给工人

-the worker function uses the token to generate an email using SES. -worker函数使用令牌使用SES生成电子邮件。 The URLs in the email call either SendTaskSuccess or SendTaskFailure using the token. 电子邮件中的URL使用令牌调用SendTaskSuccess或SendTaskFailure。

The thing works beautifully! 事情做得很漂亮! Clicking the corresponding URL in the email makes the state machine proceed to the next state or fail, respectively. 单击电子邮件中的相应URL会使状态机分别进入下一个状态或失败。 My only issue is: the input provided to the manual step is overwritten by the API gateway GET. 我唯一的问题是:手动步骤提供的输入被API网关GET覆盖。 So basically, the input of the manual step is the JSON blob above, but the output is something like: "Approve link was clicked." 因此,基本上,手动步骤的输入是上面的JSON Blob,但是输出类似:“单击了批准链接”。 (the body mapping template of the integration request). (集成请求的主体映射模板)。

So how can I make it so my manual step passes the original input as an output? 那么,如何使手动步骤将原始输入作为输出传递呢? 在此处输入图片说明

You should set your ApprovalState's ResultPath in the state's description. 您应该在状态的描述中设置ApprovalState的ResultPath By default it writes to the path's 'root' ($), but you can have it write to $.whatever by adding "ResultPath": "$.whatever" to your state's description. 默认情况下,它写入路径的“根”($),但是您可以通过在状态描述中添加"ResultPath": "$.whatever" ,将其写入$.whatever

Have a look at Amazon State Language: Path 看看Amazon State Language:Path

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过API网关调用AWS Step函数并等待执行结果 - Invoke a AWS Step functions by API Gateway and wait for the execution results 如何使用 REST API 网关同步运行 AWS Step Functions - How to run AWS Step Functions Synchronously using the REST API Gateway 在 CDK 中将 AWS Step Functions 与 API 网关集成时遇到问题 - Trouble integrating AWS Step Functions with API Gateway in CDK AWS Step Function 从 API 网关调用同步 Express 工作流,并从响应 Z78E6221F6393D14CEDZ86FZ 中消除 state 机器详细信息 - AWS Step Function synchronous Express Workflow calling from API Gateway and eliminating state machine details from response output AWS Step Functions:使用键将状态数组输出转换为对象 - AWS Step Functions: Transform a state array output to an object with keys 带 Step Function 的 AWS API 网关 - AWS API Gateway with Step Function 如何通过CloudFormation集成具有步骤功能的Api网关 - How to integrate, by CloudFormation, Api Gateway with Step Functions AWS 步进函数 map state:将 output 从当前迭代传递到下一个迭代 - AWS step functions map state: pass output from current iteration as input to next iteration AWS Step Functions - 在没有迭代发生时使用空 Map state output - AWS Step Functions - Utilize empty Map state output when no iterations occur AWS API Gateway覆盖集成请求映射模板 - AWS API Gateway Overwriting Integration Request Mapping Template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM