jeremydaly / lambda-api

Lightweight web framework for your serverless applications
https://serverless-api.com
MIT License
1.41k stars 125 forks source link

Fix Logger is not handling missing context #267

Closed RWhite-EDR closed 3 weeks ago

RWhite-EDR commented 1 month ago

Logger is not handling missing context... https://github.com/jeremydaly/lambda-api/issues/260

naorpeled commented 1 month ago

Hey @RWhite-EDR , first of all, thanks for this!

Can you please add a unit test to verify this?

RWhite-EDR commented 1 month ago

@naorpeled I'm not sure if I can as the context object is almost always present. It is only missing in my unit test of my routes. I've never seen this issue from within API Gateway, ALB, or serverless-offline. Only in my jest-based unit tests.

naorpeled commented 3 weeks ago

Hey @RWhite-EDR will make a minor change tomorrow and then release this 🙏

You rock!

Sorry for the delay

naorpeled commented 3 weeks ago

Hey @RWhite-EDR, I gave this some more thought and I think that because this isn't a real use case we shouldn't really support it. Sorry for the confusion and thanks for your time.

RWhite-EDR commented 2 weeks ago

@naorpeled Rats -- so close. I'm not sure why testing of the main function using Jest isn't a real use case. Maybe I need a better mock, but I can show you where this is failing from my test scripts.