创建了一个 Lambda 函数以从 AWS Textract API 获取分析。这是相关代码(Node.js 12)
exports.handler = async (event, context, callback) => {
...
let request = textract.getDocumentAnalysis(params);
request.send((err, data) => {
if (err) console.log(err, err.stack);
else console.log(data);
});
callback(null, request);
};
Run Code Online (Sandbox Code Playgroud)
在 CloudWatch 日志中收到此错误:
ERROR Invoke Error
{
"errorType": "Error",
"errorMessage": "Unable to stringify response body",
"stack": [
"Error: Unable to stringify response body",
" at _trySerializeResponse (/var/runtime/RAPIDClient.js:175:11)",
" at RAPIDClient.postInvocationResponse (/var/runtime/RAPIDClient.js:45:22)",
" at complete (/var/runtime/CallbackContext.js:33:12)",
" at callback (/var/runtime/CallbackContext.js:43:7)",
" at /var/runtime/CallbackContext.js:104:16",
" at Runtime.exports.handler …Run Code Online (Sandbox Code Playgroud)