Code Monkey home page Code Monkey logo

serverless-lambda-prune-plugin's People

Contributors

hideyuki avatar icereval avatar nopik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

serverless-lambda-prune-plugin's Issues

Run during `function deploy`

In my opinion this plugin should run right after an sls function deploy to prune the just deployed Lambda. I'm not a big fan that it touches Lambdas that aren't part of the current project/component. In fact, I would suggest to even remove that to avoid accidental deletions.

With the new plugin framework this should be easy to achieve. Let me know if I can help.

Specify function to remove from

Currently the Prune plugin deletes older versions of Lambdas outside of my project (as per the documentation). It would be beneficial to be able to specify a specific function which to remove older versions from. We might not always want to remove "older" functions not associated with a Serverless project, because they might be used by other, non-serverless applications.

Serverless 0.5.x compatibility

This plugin doesn't seem to work with latest serverless v0.5.0.

/node_modules/bluebird/js/release/async.js:49
        fn = function () { throw arg; };
                           ^

TypeError: Path must be a string. Received undefined
  at assertPath (path.js:8:11)
  at Object.posix.join (path.js:479:5)

Support project-wide prune (account prune with option)

When working with different people/teams in an AWS account it is not very helpful to have account wide pruning only.

Imagine some developers doing experiments on a test project (where lots of old test lambdas can remain) a project wide pruning would be very helpful.

The prune plugin should only prune functions contained in the active project by default, but when started with --all or --account prune everything everywhere.

ServerlessError: In the command you just typed, the "function" is valid but "prune" is not.

After installing the function in my project root via npm install serverless-lambda-prune-plugin i do run

sls function prune and get the following error:

ServerlessError: In the command you just typed, the "function" is valid but "prune" is not.

What am i doing wrong?

Here is the full error:

/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

ServerlessError: In the command you just typed, the "function" is valid but "prune" is not.  Enter "serverless help" to see the actions for this context.
  at new ServerlessError (/usr/local/lib/node_modules/serverless/lib/Error.js:17:11)
  at Serverless.command (/usr/local/lib/node_modules/serverless/lib/Serverless.js:363:31)
  at /usr/local/lib/node_modules/serverless/bin/serverless:19:16
  at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
  at Object.<anonymous> (/usr/local/lib/node_modules/serverless/bin/serverless:18:4)
  at Module._compile (module.js:409:26)
  at Object.Module._extensions..js (module.js:416:10)
  at Module.load (module.js:343:32)
  at Function.Module._load (module.js:300:12)
  at Function.Module.runMain (module.js:441:10)
  at startup (node.js:134:18)
  at node.js:962:3

I am running serverless v 0.5.5

Serverless 0.1.x compatibility

With the changes to Serverless 0.1.x this doesn't work out-of-the-box anymore. However, I could easily fix this by changing the last few lines of index.js from this:

      return this.S.validateProject()
        .bind(_this)
        .then(function() {
          return _this.evt;
        })
        .then(_this._listLambdas);

to this:

      return _this._listLambdas(_this.evt);

My understanding is that this should work perfectly fine. I can do a pull request if you like though I wasn't sure if I missed something.

Installation instructions incomplete?

I've been using Serverless 1.8.0 for a few months now and I tried installing [email protected] according to the readme but sls function prune just prints

Command "prune" not found, Run "serverless help" for a list of all available commands.

Any suggestions?

ConfigError: Missing region in config

Installed plugin in project root and updated s-project.json to reference the plugin. Then:

$ sls function prune 
{ [ConfigError: Missing region in config]
  cause: 
   { [ConfigError: Missing region in config]
     message: 'Missing region in config',
     code: 'ConfigError',
     time: Fri Jan 15 2016 13:02:32 GMT-0800 (PST) },
  isOperational: true,
  code: 'ConfigError',
  time: Fri Jan 15 2016 13:02:32 GMT-0800 (PST) }

I see that the region can be overridden with an AWS_REGION environment variable, but if I set that, there are more issues. It seems like there is an issue in referencing the correct configuration:

AWS_REGION=us-west-1 sls function prune 
{ [TimeoutError: Missing credentials in config]
  cause: 
   { [TimeoutError: Missing credentials in config]
     message: 'Missing credentials in config',
     code: 'CredentialsError',
     time: Fri Jan 15 2016 13:05:15 GMT-0800 (PST),
     originalError: 
      { message: 'Could not load credentials from any providers',
        code: 'CredentialsError',
        time: Fri Jan 15 2016 13:05:15 GMT-0800 (PST),
        originalError: [Object] } },
  isOperational: true,
  code: 'CredentialsError',
  time: Fri Jan 15 2016 13:05:15 GMT-0800 (PST),
  originalError: 
   { message: 'Could not load credentials from any providers',
     code: 'CredentialsError',
     time: Fri Jan 15 2016 13:05:15 GMT-0800 (PST),
     originalError: 
      { message: 'Connection timed out after 1000ms',
        code: 'TimeoutError',
        time: Fri Jan 15 2016 13:05:15 GMT-0800 (PST) } } }

default aws user is used instead of the one in admin.env

Ease of use enhancement:

Having two aws-profiles in my .aws/credentials Serverless normally takes the one specified in ./admin.env/. But tis plugin does not use this profile but takes the default one.

My .aws/credentials look as follows:

[default]
aws_access_key_id = ***
aws_secret_access_key = ***

[serverless]
aws_access_key_id = ***
aws_secret_access_key = ***
region = eu-central-1

Select AWS credentials profile

I have several profiles in my ~/.aws/credentials file. I'd like to select one to use with this plugin. How can I do that?

Thanks.

Rate limit keeps causing the plugin to crash

Every time I run the plugin, it starts pruning but shortly after I get Unhandled rejection TooManyRequestsException: Rate exceeded which causes it to crash. I can run it over an over, but I only get a handful of successful deletions out of i.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.