Integrate with "Serverless invoke local" and change the "webpack invoke" command
See original GitHub issueThis is a Feature Proposal
Description
Serverless offers a fully working local invoke
command that handles all possible
kinds of invocations, sets the function’s environment correctly and much more.
There is no need to have a separate webpack invoke
command that replicates (only)
parts of this functionality and binds resources to maintain it properly.
It would be better to integrate seamlessly with local invoke
by hooking the important
lifecycle events exposed by the command. Finally, serverless invoke local
should
invoke the function after the webpack compile has been triggered as part of the lifecycle
hooks in place.
To make it completely seamless, the webpack invoke
command should techincally just use Serverless’
pluginManager to spawn the invoke local
command like this: this.serverless.pluginManager.spawn('invoke:local')
.
This solution would also make the invocation provider independent as Serverless fully takes care of that already.
Related issue(s): #128 (arbitrary provider support)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:8 (8 by maintainers)
@benjaminwood @hassankhan The basic implementation is finished (support of “serverless invoke local”), i.e. sls invoke local should now work with the plugin. I did a few tests with my test project. Could you also verify that it works with this PR (#153)?
I will finish it over the weekend and remove the now obsolete code, adapt the docs and write unit tests.
Hey @benjaminwood . Thanks a lot, good catch 👍 . In general, it is better to open a PR instead of linking a commit - regardless if the approach is feasible or not. It’s just easier to discuss a possible solution/implementation within a PR in GitHub - as easy as it is to merge or revoke the PR later. This will keep the main issue clean (the PR candidates are still listed if they are linked correctly) and put the implementation specific discussion near to the implementation itself.
So just open a PR 😃 - I added templates for PRs recently, so the PR description will additionally contain important info (e.g. if it is ready for review/discussion, etc.). Target the PR to the
v3.0.0-invoke-local
branch.… and I’m really glad to hear that my changes work (with exception of the path issue)