-
-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(adapter/aws-lambda): add alb event requestContext undefined check for testing convenience #3691
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3691 +/- ##
=======================================
Coverage 91.70% 91.70%
=======================================
Files 159 159
Lines 10145 10162 +17
Branches 2910 2883 -27
=======================================
+ Hits 9303 9319 +16
- Misses 840 842 +2
+ Partials 2 1 -1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Hi @ospatil Thank you for the PR. Looks good, but one thing. Can you write a test for this change? There may not be enough tests for this AWS Lambda adapter currently, but we have to add a test for the patch. |
@yusukebe I have added tests for A big shout-out to you and the team for this amazing project 🙌🏼 . |
if (event.requestContext) { | ||
return Object.hasOwn(event.requestContext, 'elb') | ||
} | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not covered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
New tests are not executed since approval needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Nice job! I'll merge this and release a new version. Thank you for your contribution! |
Issue Summary
While testing a lambda using
aws lambda invoke
or from the AWS Console, the currentaws-lambda
adapterisProxyEventALB
implementation results in following error:This can be reproduced by scaffolding a lambda project using
npm create hono@latest
and deploying it in an AWS account without any changes to the code.Benefits of the fix
A fix by adding an undefined check for
event.requestContext
will significantly ease the testing of lambda using simple tools likeaws lambda invoke
and AWS Console.The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the code