-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Local function invocation with handler path containing dot in folder name #7398
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7398 +/- ##
==========================================
- Coverage 88.02% 87.99% -0.04%
==========================================
Files 240 240
Lines 9010 9044 +34
==========================================
+ Hits 7931 7958 +27
- Misses 1079 1086 +7
Continue to review full report at Codecov.
|
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.
@arapulido great thanks for that! I've proposed one style improvement. Let me know what you think
lib/plugins/aws/invokeLocal/index.js
Outdated
const handlerComponents = handler.split(/\./); | ||
const handlerPath = handlerComponents.slice(0, -1).join('.'); | ||
const handlerName = handlerComponents.pop(); |
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.
Probably less convoluted will be that way (?)
const handlerComponents = handler.split(/\./); | |
const handlerPath = handlerComponents.slice(0, -1).join('.'); | |
const handlerName = handlerComponents.pop(); | |
const handlerSeparatorIndex = handler.lastIndexOf('.'); | |
const handlerPath = handler.slice(0, handlerSeparatorIndex); | |
const handlerName = handler.slice(handlerSeparatorIndex + 1); |
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.
Hi @medikoo , thank you very much for your feedback, it's appreciated! Your suggestion does look better so I'll adapt the code.
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.
Thank you @arbbakbenny !
What did you implement
Closes #7330
How can we verify it
Automatically
Checkout to commit
a7da3400e3dc5abfe1bac8a4eb251f2d7e4dd0d1
and runlib/plugins/aws/invokeLocal/index.test.js
. Testshould fail.
Checkout to the HEAD and run the test again, it should pass.
Manually
Create following project structure
with reference in
serverless.yml
Executing
serverless invoke local -f hello
should return proper response instead of throwing an error.Todos
Is this ready for review?: Yes
Is it a breaking change?: No