簡體   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