Seeing below errors intermittently:
SyntaxError: Unexpected token e in JSON at position 713 at JSON.parse (<anonymous>) at parse (/layers/google.nodejs.functions-framework/functions-framework/node_modules/body-parser/lib/types/json.js:89:19)
Purpose of Cloud function: read request and send it to logs (Logging)
Issue: Intermittent syntax error, sometimes error comes after function is done logging (towards end). Sometimes its at start. Tracing request ID, no issue was found with request. Rerun of request did not result in issue replication.
Seems like node js is stuck or having some issues with instances
Solved! Go to Solution.
We got service ticket opened and got it resolved. It was due to race condition as async (log.write) function was being called without await on it.
Can you include more details about the Cloud Function you have deployed such as region and dependencies? Can you also share a request sample that has failed being parsed in your function? On the other hand, have you continued experiencing these intermittent errors in your Function?
We got service ticket opened and got it resolved. It was due to race condition as async (log.write) function was being called without await on it.