Closed yspreen closed 3 months ago
adding these lines causes a crash:
const awsRequestId = JSON.parse(
decodeURIComponent(req.headers["x-apigateway-context"] as string)
).awsRequestId.replace(/(...).*(...)/, "$1…$2");
maybe JSON encoding is to blame. not sure. this definitely crashes a handler:
JSON.parse(decodeURIComponent(encodeURIComponent(JSON.stringify(context))))
works fine in node18
it appears the bug is in the JSON encoder.
this line
getRemainingTimeInMillis: [function: getRemainingTimeInMillis],
turns into
"getRemainingTimeInMillis":,
which is not valid JSON.
Its most likely related to this issue: https://github.com/awslabs/llrt/pull/263 I'm creating a new release today
@yspreen released now: https://github.com/awslabs/llrt/releases/tag/v0.1.12-beta
I'm getting 502 errors with
Runtime exited without providing a reason Runtime.ExitError
and no other info.Is
decodeURIComponent
the culprit?I'm also trying to run
process.hrtime()[1]
in order to get a sub-ms timer but that one surprisingly doesn't cause a crash.