Description
I get an error during executing state machine in the executor lambda.
Logs from Execute Lambda:
{
"errorType": "SyntaxError",
"errorMessage": "Unexpected end of JSON input",
"stack": [
"SyntaxError: Unexpected end of JSON input",
" at JSON.parse ()",
" at /var/task/utils.js:552:54",
" at Array.map ()",
" at module.exports.extractDurationFromJSON (/var/task/utils.js:552:35)",
" at module.exports.extractDuration (/var/task/utils.js:529:22)",
" at /var/task/utils.js:473:22",
" at Array.map ()",
" at module.exports.parseLogAndExtractDurations (/var/task/utils.js:470:17)",
" at computeStatistics (/var/task/executor.js:180:29)",
" at module.exports.handler (/var/task/executor.js:71:12)"
]
}
Because the result inherits empty lines.
In utils.js there is a module function: module.exports.extractDurationFromJSON = (log) => {
const lines = log.split('\n').filter((line) => line.startsWith('{')).map((line) => {
Replacing it with:
const lines = log.split('\n').filter(line => line.trim() !== '').map((line) => JSON.parse(line));
it works. Best Regards