我正在从Lambda启动step函数,并且Lambda函数绑定到API网关。由于某种原因,当我尝试测试Lambda函数时,我看到数百次执行失败并循环运行。我刚刚触发了一次步进功能。我在这里错过了一些东西。你能请教吗?
const AWS = require("aws-sdk");
const uuidv4 = require("uuid/v4");
/*----------------------------------------------------------------------- */
/* Implementation */
/*----------------------------------------------------------------------- */
exports.handler = async event => {
var _dt = await ExecuteStepFunction()
return _dt;
}
function ExecuteStepFunction() {
const stepFunctions = new AWS.StepFunctions();
return new Promise((res, rej) => {
var params = {
stateMachineArn: 'arn:aws:states:us-east-1:xxxxxxxxxxxxx:stateMachine:xxTestSateMachine',
input: JSON.stringify(''),
name: uuidv4()
};
stepFunctions.startExecution(params, function (err, data) {
if (err) {
rej(err);
}
else {
res(data);
}
});
});
}
我尝试了此链接(https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-api-gateway.html)中提供的这种方法,其中API网关直接触发了步进功能,但我收到以下错误。尝试解决此问题后,我转到使用API启动功能的上述选项。
{
"__type": "com.amazon.coral.service#UnrecognizedClientException",
"message": "The security token included in the request is invalid"
}