{"id":32972675,"url":"https://github.com/gunnargrosch/failure-lambda","last_synced_at":"2026-01-11T23:05:24.209Z","repository":{"id":36713697,"uuid":"229837364","full_name":"gunnargrosch/failure-lambda","owner":"gunnargrosch","description":"Module for fault injection into AWS Lambda","archived":false,"fork":false,"pushed_at":"2024-08-20T13:44:25.000Z","size":258,"stargazers_count":97,"open_issues_count":9,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-15T01:04:17.801Z","etag":null,"topics":["aws","chaos","chaosengineering","failure","failure-injection","fault-injection","lambda"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gunnargrosch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-23T23:31:49.000Z","updated_at":"2025-09-10T12:38:08.000Z","dependencies_parsed_at":"2024-10-30T05:52:34.518Z","dependency_job_id":null,"html_url":"https://github.com/gunnargrosch/failure-lambda","commit_stats":{"total_commits":36,"total_committers":5,"mean_commits":7.2,"dds":0.4722222222222222,"last_synced_commit":"743aef466e950cd3386956962b0d2a77d64da64d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/gunnargrosch/failure-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gunnargrosch","download_url":"https://codeload.github.com/gunnargrosch/failure-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-lambda/sbom","scorecard":{"id":449463,"data":{"date":"2025-08-11","repo":{"name":"github.com/gunnargrosch/failure-lambda","commit":"743aef466e950cd3386956962b0d2a77d64da64d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":2,"reason":"Found 3/14 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"32 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-rx28-r23p-2qc3","Warn: Project is vulnerable to: GHSA-v4mq-x674-ff73","Warn: Project is vulnerable to: GHSA-5pq3-h73f-66hr","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-6pw2-5hjv-9pf7","Warn: Project is vulnerable to: GHSA-4w2j-2rg4-5mjw","Warn: Project is vulnerable to: GHSA-mrgp-mrhc-5jrq","Warn: Project is vulnerable to: GHSA-7jxr-cg7f-gpgv","Warn: Project is vulnerable to: GHSA-xj72-wvfv-8985","Warn: Project is vulnerable to: GHSA-ch3r-j5x3-6q2m","Warn: Project is vulnerable to: GHSA-p5gc-c584-jj6v","Warn: Project is vulnerable to: GHSA-whpj-8f3w-67p5","Warn: Project is vulnerable to: GHSA-cchq-frgv-rjh5","Warn: Project is vulnerable to: GHSA-g644-9gfx-q4q4","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T07:47:49.122Z","repository_id":36713697,"created_at":"2025-08-19T07:47:49.122Z","updated_at":"2025-08-19T07:47:49.122Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28326198,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T22:11:01.104Z","status":"ssl_error","status_checked_at":"2026-01-11T22:10:58.990Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","chaos","chaosengineering","failure","failure-injection","fault-injection","lambda"],"created_at":"2025-11-13T05:00:36.467Z","updated_at":"2026-01-11T23:05:24.202Z","avatar_url":"https://github.com/gunnargrosch.png","language":"JavaScript","readme":"# Failure injection for AWS Lambda - failure-lambda\n\n## Description\n\n`failure-lambda` is a small Node module for injecting failure into AWS Lambda (https://aws.amazon.com/lambda). It offers a simple failure injection wrapper for your Lambda handler where you then can choose to inject failure by setting the `failureMode` to `latency`, `exception`, `denylist`, `diskspace` or `statuscode`. You control your failure injection using SSM Parameter Store or [AWS AppConfig](https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html).\n\n## How to install with parameter in SSM Parameter Store\n\n1. Install `failure-lambda` module using NPM.\n```bash\nnpm install failure-lambda\n```\n2. Add the module to your Lambda function code.\n```js\nconst failureLambda = require('failure-lambda')\n```\n3. Wrap your handler.\n```js\nexports.handler = failureLambda(async (event, context) =\u003e {\n  ...\n})\n```\n4. Create a parameter in SSM Parameter Store.\n```json\n{\"isEnabled\": false, \"failureMode\": \"latency\", \"rate\": 1, \"minLatency\": 100, \"maxLatency\": 400, \"exceptionMsg\": \"Exception message!\", \"statusCode\": 404, \"diskSpace\": 100, \"denylist\": [\"s3.*.amazonaws.com\", \"dynamodb.*.amazonaws.com\"]}\n```\n```bash\naws ssm put-parameter --region eu-west-1 --name failureLambdaConfig --type String --overwrite --value \"{\\\"isEnabled\\\": false, \\\"failureMode\\\": \\\"latency\\\", \\\"rate\\\": 1, \\\"minLatency\\\": 100, \\\"maxLatency\\\": 400, \\\"exceptionMsg\\\": \\\"Exception message!\\\", \\\"statusCode\\\": 404, \\\"diskSpace\\\": 100, \\\"denylist\\\": [\\\"s3.*.amazonaws.com\\\", \\\"dynamodb.*.amazonaws.com\\\"]}\"\n```\n5. Add an environment variable to your Lambda function with the key FAILURE_INJECTION_PARAM and the value set to the name of your parameter in SSM Parameter Store.\n6. Add permissions to the parameter for your Lambda function.\n7. Try it out!\n\n## How to install with hosted configuration in AWS AppConfig\n\n1. Install `failure-lambda` module using NPM.\n```bash\nnpm install failure-lambda\n```\n2. Add the module to your Lambda function code.\n```js\nconst failureLambda = require('failure-lambda')\n```\n3. Wrap your handler.\n```js\nexports.handler = failureLambda(async (event, context) =\u003e {\n  ...\n})\n```\n4. Create Application, Environment, Configuration Profile, and Hosted Configuration in AppConfig console.\n5. Deploy a version of the configuration.\n6. Add the AWS AppConfig layer for Lambda extensions to your Lambda function. [See details](https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-integration-lambda-extensions.html).\n7. Add environment variables to your Lambda function.\n```bash\nFAILURE_APPCONFIG_APPLICATION: YOUR APPCONFIG APPLICATION\nFAILURE_APPCONFIG_ENVIRONMENT: YOUR APPCONFIG ENVIRONMENT\nFAILURE_APPCONFIG_CONFIGURATION: YOUR APPCONFIG CONFIGURATION PROFILE\n```\n8. Add permissions to the AppConfig Application, Environment, and Configuration Profile for your Lambda function.\n9. Try it out!\n\n## Usage\n\nEdit the values of your parameter in SSM Parameter Store or hosted configuration in AWS AppConfig to use the failure injection module.\n\n* `isEnabled: true` means that failure is injected into your Lambda function.\n* `isEnabled: false` means that the failure injection module is disabled and no failure is injected.\n* `failureMode` selects which failure you want to inject. The options are `latency`, `exception`, `denylist`, `diskspace` or `statuscode` as explained below.\n* `rate` controls the rate of failure. 1 means that failure is injected on all invocations and 0.5 that failure is injected on about half of all invocations.\n* `minLatency` and `maxLatency` is the span of latency in milliseconds injected into your function when `failureMode` is set to `latency`.\n* `exceptionMsg` is the message thrown with the exception created when `failureMode` is set to `exception`.\n* `statusCode` is the status code returned by your function when `failureMode` is set to `statuscode`.\n* `diskSpace` is size in MB of the file created in tmp when `failureMode` is set to `diskspace`.\n* `denylist` is an array of regular expressions, if a connection is made to a host matching one of the regular expressions it will be blocked.\n\n## Example\n\nIn the subfolder `example` is a sample application which will install an AWS Lambda function, an Amazon DynamoDB table, and a parameter in SSM Parameter Store. You can install it using AWS SAM, AWS CDK, or Serverless Framework.\n\n### AWS SAM\n```bash\ncd example/sam\nnpm install\nsam build\nsam deploy --guided\n```\n\n### AWS CDK\n```bash\ncd example/cdk\nnpm install\ncdk deploy\n```\n\n### Serverless Framework\n```bash\ncd example/sls\nnpm install\nsls deploy\n```\n\n## Notes\n\nInspired by Yan Cui's articles on latency injection for AWS Lambda (https://hackernoon.com/chaos-engineering-and-aws-lambda-latency-injection-ddeb4ff8d983) and Adrian Hornsby's chaos injection library for Python (https://github.com/adhorn/aws-lambda-chaos-injection/).\n\n## Changelog\n\n### 2022-02-14 v0.4.4\n\n* Switch to node-fetch@2.\n\n### 2022-02-14 v0.4.3\n\n* Updated dependencies.\n\n### 2021-03-16 v0.4.2\n\n* Puts the mitm object in the library global namespace so that it persists across function invocations.\n* Syntax formatting.\n\n### 2020-10-26 v0.4.1\n\n* Made AppConfig Lambda extension port configurable using environment variable.\n\n### 2020-10-25 v0.4.0\n\n* Added optional support for AWS AppConfig, allowing to validate failure configuration, deploy configuration using gradual or non-gradual deploy strategy, monitor deployed configuration with automatical rollback if CloudWatch Alarms is configured, and caching of configuration.\n* Hardcoded default configuration with `isEnabled: false`, to use if issues loading configuration from Parameter Store or AppConfig.\n\n### 2020-10-21 v0.3.1\n\n* Change mitm mode back to connect to fix issue with all connections being blocked.\n\n### 2020-08-24 v0.3.0\n\n* Changed mitm mode from connect to connection for quicker enable/disable of failure injection.\n* Renamed block list failure injection to denylist (breaking change for that failure mode).\n* Updated dependencies.\n\n### 2020-02-17 v0.2.0\n\n* Added block list failure.\n* Updated example application to store file in S3 and item in DynamoDB.\n\n### 2020-02-13 v0.1.1\n\n* Fixed issue with exception injection not throwing the exception.\n\n### 2019-12-30 v0.1.0\n\n* Added disk space failure.\n* Updated example application to store example file in tmp.\n\n### 2019-12-23 v0.0.1\n\n* Initial release\n\n## Contributors\n\n**Gunnar Grosch** - [GitHub](https://github.com/gunnargrosch) | [Twitter](https://twitter.com/gunnargrosch) | [LinkedIn](https://www.linkedin.com/in/gunnargrosch/)\n\n**Jason Barto** - [GitHub](https://github.com/jpbarto) | [Twitter](https://twitter.com/Jason_Barto) | [LinkedIn](https://www.linkedin.com/in/jasonbarto)\n\n## License\n\nThis code is made available under the MIT-0 license. See the LICENSE file.","funding_links":[],"categories":["3. Fault Injection","Notable Tools"],"sub_categories":["Cloud"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunnargrosch%2Ffailure-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgunnargrosch%2Ffailure-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunnargrosch%2Ffailure-lambda/lists"}