question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integrate with "Serverless invoke local" and change the "webpack invoke" command

See original GitHub issue

This 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
HyperBraincommented, Jul 14, 2017

@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.

1reaction
HyperBraincommented, Jul 15, 2017

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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serverless Webpack - Serverless Framework: Plugins
Run a function locally. The plugin fully integrates with serverless invoke local . To run your bundled functions locally you can:
Read more >
Serverless Webpack in Lambda Simplified 101 - Learn | Hevo
Run a Function Locally on Source Changes. Alternatively, use the —watch option with serverless invoke local: to run a function every time the ......
Read more >
Serverless Plugin to Bundle Your Lambdas with Webpack
The plugin fully integrates with serverless invoke local . To run your bundled functions ... :exclamation: The old webpack invoke command has been...
Read more >
Create a Serverless App on AWS using TypeScript — Part 1
Serverless architecture and microservices have changed the way we think ... The serverless invoke local command allows us to run our Lambda ...
Read more >
serverless-webpack/README.md - UNPKG
The CDN for serverless-webpack. ... 173, $ serverless webpack invoke --function <function-name> ... 181, ### Run a function locally on source changes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found