lambda-leak

AWS Lambda Resource Leak Detector

Showing:

Popularity

Downloads/wk

15.5K

GitHub Stars

4

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.4KB

License

BSD-3-Clause

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Build Status

lambda-leak

Simple utility to detect resource leaks in AWS Lambda handlers using Node.js that can lead to expensive charges lengthy operations or failures from timeouts.

Features

  • Detects socket leaks
  • Detects excess timers
  • Works with mocha's timeout system
  • Works with Node 6.10.x

Installation

Install via npm.

npm install lambda-leak

Getting Started

The lambda-leak detector should be used within a unit testing environment, like mocha, to capture and diagnose potential resource leaks. The following example demonstrates how to use the leak detector inside a unit test.

'use strict';

const lambdaLeak = require( 'lambda-leak' );

const handler = require( 'my-lambda-handler-module' );

describe( 'myModule', function() {

    describe( 'handler', function() {

        it( 'detect leak in my handler', function( done ) {

            const state = lambdaLeak.capture();

            handler( {/* event*/, { /* context */}, function( err, result ) {

                if( err ) {

                    return done( err );
                }

                let difference = state..getDifferenceInHandles();

                if( difference.length > 0 ) {

                    console.log( 'leaks', difference );

                    // leaks detected
                    done( new Error( 'leaks detected' ) );
                }

                done();
            });
        });
    });
});

Projects Using lambda-leak

  • lambda-tester - reduce the time and effort to test AWS Lambda handlers.

Feedback

We'd love to get feedback on how you're using lambda-tester and things we could add to make this tool better. Feel free to contact us at feedback@vandium.io

License

BSD-3-Clause

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial