Skip to content
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

Option to not integrate with invoke #288

Open
jawadst opened this issue Nov 27, 2017 · 5 comments
Open

Option to not integrate with invoke #288

jawadst opened this issue Nov 27, 2017 · 5 comments
Labels

Comments

@jawadst
Copy link

jawadst commented Nov 27, 2017

This is a Feature Proposal

Description

It'd be great to have an option to not run webpack when running invoke. Locally, I test with node 8 and only need webpack/babel when deploying to Lambda.

@HyperBrain
Copy link
Member

Hi @jawadst ,

thanks for opening the feature request. This option would disable the whole plugin on request (e.g. if a --webpack-disable) switch would be given. Maybe the functionality would fit better into Serverless - i.e. provide a command line switch there, to disable arbitrary plugins with a command line switch, as it would make sense for a few other plugins too.

However, by disabling webpack on demand, I see some drawbacks:

  • The local tests are not representative anymore, because you test different code than the one actually deployed - in fact they are not representative already, as you use a different Node version locally ;-)
  • The invoke local --watch variant of the command is disabled too, to have a continuous test running after code changes.

A change in Serverless to support a generic switch looks trivial to me. I can implement it and open a PR there that references this issue. Then it would be in Serverless 1.25, or more likely 1.26.

What do you think?

@jawadst
Copy link
Author

jawadst commented Nov 30, 2017

Hi @HyperBrain,

I agree that enabling this option makes the tests less representative. That being said, we have been doing this for a while (we usually develop with node >= 8 and run our tests that way too) without any issue so far so my take on this is that the benefits seem higher than the risk for us. I totally understand some people might disagree on that which is why I was thinking of it as an option.

As for the invoke local --watch, my understanding is that your generic switch would allow to either keep the plugin enabled (no switch) or disabled for that command as well, right?

Thanks a lot for your response and your work on this plugin, it's very helpful!

@HyperBrain
Copy link
Member

Yes, your assumption is right - the plugin would be completely disabled.
I will create an issue in Serverless for the functionality and might be able to implement it soon.

@jawadst
Copy link
Author

jawadst commented Dec 1, 2017

Souds great, thanks you very much!

@HyperBrain
Copy link
Member

HyperBrain commented Mar 14, 2018

@jawadst This might be partially solved with #341. invoke local now supports a --no-build option that runs the invoke on already compiled code. Of course this does not obsolete doing at least one compile as you suggested, but is a huge improvement especially for CI or local integration tests.

You would now do:

$ serverless webpack
$ serverless invoke local --function <function-name-1> --no-build
$ serverless invoke local --function <function-name-2> --no-build

However, I'm still thinking about the disabling of the compile at all, but out from the plugin I did not find a viable solution as it overrides the packaging and execution to point to the compiled code.

Please let me know if this already helps you at least a bit 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants