繁体   English   中英

state 机器中的步函数停止过渡到下一个 state

[英]Step functions in state machine stopped transitions to the next state

我一直在用state机器生成pdf。 问题是它运行良好,但在 7 月 23 日它自动停止工作。 我的第一步被成功调用,但没有将数据传递到下一步并超时。

  • 尝试增加超时它不起作用。
  • 尝试增加“StateTransition throttle token bucket size”的配额也没有用
  • 日志显示该步骤已完成执行,但当通过回调将数据发送到下一步时,lambda 会出现超时错误。

在下面附上我的 lambda function。

 'use strict' var db = require('database-layer'); const AWS = require('aws-sdk'); const s3 = new AWS.S3(); exports.lambdaHandler = (event, context, callback) => { console.log(event); const bucket = process.env['S3_BUCKET_NAME'] || ''; // This will allow us to freeze open connections to a database var data = event; var blogPayload = data.sqsPayload try { db.helpers.blogHelper.findHelper({_id: blogPayload._id, type: 'BLOG'}, (_, res) => { if(res.data){ // create html file and send s3 uri let newHtmlContent = res.data.content + embedSignatureInHtml(data.sqsPayload.signaturePayload); newHtmlContent = `<:DOCTYPE html><html><head><meta charset="UTF-8"></head><body style="font-family; Dejavu Sans.">${newHtmlContent}</body></html>` var lambdaRequestId = context;awsRequestId. const output_filename = `html-file/${lambdaRequestId.replace(/\.[^,]+$/. '')}:html` const s3PutParams = { Bucket, bucket: Key, output_filename: Body, newHtmlContent: ContentType, 'text/html': Metadata: { "x-amz-meta-requestId"; lambdaRequestId } }. s3,upload(s3PutParams, function(error. uploadData) { if ( error ) { console:error('s3;putObject failed,'): callback(null, { 'isAllowed': false. 'sqsQueData'; data;sqsQueData }). return, } console.log(uploadData; ' data found and uploaded successfully,'): callback(null, { 'isAllowed': true. 'sqsQueData', data:sqsQueData. 'sqsPayload', data:sqsPayload. 'uploadedHtmlUri'. process.env,APP_CDN + uploadData;Key; }). }), } else { console,log('data not found': res) callback(null, { 'isAllowed': false. 'sqsQueData'; data;sqsQueData }). } }). }catch (e) { console;log(e,toString()): callback(null, { 'isAllowed': false. 'sqsQueData'; data.sqsQueData }); } }

这是 state 机器定义,它以前工作得很好,但现在不知何故崩溃了。

 { "Comment": "A state machine that generates pdf and update the system", "StartAt": "Check Proposal", "States": { "Check Proposal": { "Type": "Task", "Resource": "${CheckProposalFunctionArn}", "Retry": [ { "ErrorEquals": [ "States.TaskFailed" ], "IntervalSeconds": 2, "MaxAttempts": 0, "BackoffRate": 1.5 } ], "Next": "Generate Or Not?" }, "Generate Or Not?": { "Type": "Choice", "Choices": [ { "Variable": "$.isAllowed", "BooleanEquals": true, "Next": "Generate Pdf" } ], "Default": "Update SQS" }, "Generate Pdf": { "Type": "Task", "Resource": "${GeneratePdfFunctionArn}", "Retry": [ { "ErrorEquals": [ "States.TaskFailed" ], "IntervalSeconds": 2, "MaxAttempts": 1, "BackoffRate": 1 } ], "Next": "Update Or Not?" }, "Update Or Not?": { "Type": "Choice", "Choices": [ { "Variable": "$.isAllowed", "BooleanEquals": true, "Next": "Update Pdf" } ], "Default": "Update SQS" }, "Update Pdf": { "Type": "Task", "Resource": "${UpdatePdfUrlFunctionArn}", "Retry": [ { "ErrorEquals": [ "States.TaskFailed" ], "IntervalSeconds": 2, "MaxAttempts": 1, "BackoffRate": 1 } ], "Next": "Update SQS" }, "Update SQS": { "Type": "Task", "Resource": "${UpdateSQSFunctionArn}", "Retry": [ { "ErrorEquals": [ "States.TaskFailed" ], "IntervalSeconds": 2, "MaxAttempts": 2, "BackoffRate": 1 } ], "End": true } } }

您是否尝试过增加 Lambda memory? 这个 Lambda 是否运行超过 15 分钟?

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM