Skip to content

Lambda with response stream showing an error in metric, but nothing in logs

3

Hi,

I've moved on of our old node services from Elastic Beanstalk to a Lambda with a function URL returning a response stream. The service that was ported weas only on EB as it's response can be more than 6MB and we use the Serverless framework with Node for our lambdas. This lambda is using Node 14.x.

Everything works find most of the time, but occasionally the Error count and success rate (%) metric shows an error but looking that the logs the lambda completed successfully. Error metric

I have turned x-ray on to see if that showed anything, but it shows all the trace status where ok, and everything looks ok when you drill down into a trace. X-Ray

Does anyone have any pointers where I could look to see what is going on?

asked 3 years ago1.2K views
5 Answers
0

Try to catch the exception and log the exception with level 'ERROR' to view in log group.

Refer below link for logging using nodejs

https://docs.aws.amazon.com/lambda/latest/dg/nodejs-logging.html

answered 3 years ago
  • Thanks. I've already done that using the Winston logger, but I'll give it a try with console. error just to make sure nothing is being missed.

0

I'm facing the same issue. I have a Docker image deployed to Lambda with a function URL with the RESPONSE_STREAM invoke mode. The function's monitoring shows errors while CloudWatch logs, X-Ray traces, and Lambda Insights don't show any errors.

When I switch the function URL's invoke mode to BUFFERED and change the function's code to work in the buffered mode, all errors disappear.

answered 2 years ago
  • Thanks, but we need to use the RESPONSE_STREAM as the response can be larger than 6MB.

0

Hey, I'm facing the same error, and I also need to use RESPONSE_STREAM. In my case, the execution is working 100% (so there is no problems with logs). However, it keeps showing that the execution ends with a timeout. Did you guys find any way to deal with it?

answered 2 years ago
  • Sorry we haven't found a solution, and the service is in the process of being retried.

0

I'm seeing this too. I'm using a Lambda with RESPONSE_STREAM's to stream out LLM responses, and things are working fine, but now that its getting hit a bit more these errors in CloudWatch are unsettling. Error rate is about 0.05-0.1.

I've jacked SYSTEM and APP level logging on my lambda, see more errors happen in the charts, but nothing in the logs. Memory looks good, duration is fine, yet these errors.

The only thing i can think of is given this is not behind APIGW or cloudwatch and i wonder if clients kill connections prematurely or something like that it goes outside the realm of the logs and just into the void.

Would love a response from AWS on this, it selfishly feels like a bug with Lambda streaming.

Errors Chart

answered 2 years ago
0

One solution that we've found helps is ensuring all work is completed before closing the response stream. We were previously closing the response stream then awaiting any side effect work which was causing this problem of intermittent CloudWatch errors. I haven't been able to find any documentation on this, but it seems like the Lambda is being shut-down once the response stream is closed.

answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.