{"id":41290809,"url":"https://github.com/ovatto/agw-lambda-proxy","last_synced_at":"2026-01-23T03:31:20.736Z","repository":{"id":57174659,"uuid":"118015419","full_name":"ovatto/agw-lambda-proxy","owner":"ovatto","description":"Helper module for creating Lambda functions for handling AWS API Gateway Lambda Proxy Integration calls","archived":false,"fork":false,"pushed_at":"2018-10-11T14:00:25.000Z","size":55,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T01:11:22.666Z","etag":null,"topics":["aws","aws-api-gateway","aws-lambda","javascript"],"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/ovatto.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-18T17:31:09.000Z","updated_at":"2023-01-10T09:01:40.000Z","dependencies_parsed_at":"2022-08-28T21:00:15.083Z","dependency_job_id":null,"html_url":"https://github.com/ovatto/agw-lambda-proxy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ovatto/agw-lambda-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovatto%2Fagw-lambda-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovatto%2Fagw-lambda-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovatto%2Fagw-lambda-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovatto%2Fagw-lambda-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ovatto","download_url":"https://codeload.github.com/ovatto/agw-lambda-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovatto%2Fagw-lambda-proxy/sbom","scorecard":{"id":715092,"data":{"date":"2025-08-11","repo":{"name":"github.com/ovatto/agw-lambda-proxy","commit":"89f0974b0b65e4d02f1211563d24c494ad96ae4a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"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":"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":"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":"Code-Review","score":0,"reason":"Found 1/27 approved changesets -- score normalized to 0","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":"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":"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":"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":"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":"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":"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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 4 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":"21 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-3gx7-xhv7-5mx3","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"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-22T09:22:24.547Z","repository_id":57174659,"created_at":"2025-08-22T09:22:24.547Z","updated_at":"2025-08-22T09:22:24.547Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28679149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T01:00:35.747Z","status":"online","status_checked_at":"2026-01-23T02:00:08.296Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","aws-api-gateway","aws-lambda","javascript"],"created_at":"2026-01-23T03:31:19.449Z","updated_at":"2026-01-23T03:31:20.723Z","avatar_url":"https://github.com/ovatto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  AWS API Gateway Lambda Proxy Integration module\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/agw-lambda-proxy\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/agw-lambda-proxy.svg\" alt=\"npm version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://standardjs.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/code_style-standard-brightgreen.svg\" alt=\"Standard - JavaScript Style Guide\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/ovatto/agw-lambda-proxy\"\u003e\u003cimg src=\"https://travis-ci.org/ovatto/agw-lambda-proxy.svg?branch=master\" alt=\"build status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## What is this?\n\nHelper module for creating Lambda functions for handling AWS API Gateway Lambda\nProxy Integration calls. See [AWS docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy-for-lambda.html) for details.\n\nProvides common error handling and response formatting for proxy Lambda functions.\n\n## Installation\n\nSimply install with [npm](http://npmjs.org):\n\n```sh\nnpm install agw-lambda-proxy\n```\n\n## Usage\n\nThe module exports contains a function **createHandler** that can be used for\ngenerating the Lambda handler function. The generated function handles the\n**event**, **context**, and **callback** parameters that the Lambda runtime\npasses so it can be directly used as the handler for your Lambda function.\n\nThe generator function accepts two parameters: **delegate** and **options**. The\n**delegate** is a mandatory parameter and must be a function. This function is\ndefined by the caller and can be used for processing the Lambda request - when\nLambda function is invoked the framework passes the **event** and **context**\nparameters to the delegate for request processing. The return value of the\ndelegate function is used for generating the Lambda function response and it\nshould be either a promise or a direct value if asynchronous processing is not\nneeded. Rejections and thrown errors are automatically handled. See\n[Error handling](#error-handling) for details.\n\nThe **options** parameter can be used for overriding some of the defaults in\nthe request and response processing, including response headers.\n\n### Example\n\nAssuming you've put \"index.handler\" as your Lambda handler value you can use\nfollowing index.js for simply returning a response with body \"static string\",\nstatus code 200 and default headers (see [CORS \u0026 response headers](#cors--response-headers)\nfor details).\n\n```javascript\nconst delegate = (event, context) =\u003e {\n  return Promise.resolve('static string')\n}\nmodule.exports = {\n  handler: require('agw-lambda-proxy').createHandler(delegate)\n}\n```\n\n## Response formatting\n\nThe delegate function can return the response in few different ways. For simple\nresponses the function can return a string value. In this case the response's\nbody will be the returned string and default status code 200 is used. This\ncase is shown above.\n\nIf the return value is an object and the object contains one of the attributes\n**statusCode**, **body**, or **headers** the Lambda response is generated from\nthese attributes and default values for missing attribute. If the **body** is\nnot a string value it is automatically stringified.\n\n```javascript\nconst delegate = (event, context) =\u003e {\n  return callSomeCreationFunction()\n    .then((created) =\u003e {\n      return {\n        statusCode: 201,\n        body: {\n          id: created.id,\n          message: \"Object created\"\n        }\n      }\n    })\n}\nmodule.exports = {\n  handler: require('agw-lambda-proxy').createHandler(delegate)\n}\n```\n\nThe handling for each attribute is specified in the table below:\n\nattribute|When specified|Default value\n---------|--------------|-------------\nstatusCode|Parsed as an integer HTTP status code. If parsing fails, default is used.|200\nbody|If string, returned as is. Otherwise stringified with JSON.stringify|''\nheaders|Properties used as HTTP response headers.|See [CORS \u0026 response headers](#cors--response-headers)\n\nIf the returned object does not have any of the attributes **statusCode**,\n**body** or **headers** the object is stringified as response body and default\nstatus code 200 and headers are used:\n\n```javascript\nconst delegate = (event, context) =\u003e {\n  return {\n    foo: 'bar'\n  }\n}\nmodule.exports = {\n  handler: require('agw-lambda-proxy').createHandler(delegate)\n}\n```\n\n\n## CORS \u0026 response headers\n\n### Default headers\n\nBy default, the Lambda function response will specify the header\n\"Access-Control-Allow-Origin\" with value \"\\*\". The default behaviour can be\nchanged by providing an **options** object with **headers** attribute in the\nhandler creation:\n\n```javascript\nconst defaultHeaders = {\n  'Access-Control-Allow-Origin': 'https://github.com',\n  'Some-Other-Default-Header': 'header value'\n}\nmodule.exports = {\n  handler: require('agw-lambda-proxy').createHandler(delegate, {headers:defaultHeaders})\n}\n```\n\nNote that when overwritten default headers don't contain a value for\n'Access-Control-Allow-Origin' the response will not have the default CORS\nheader.\n\n### Response headers\n\nWhen using the object format in the delegate return value the headers can\nalso be specified for individual responses:\n\n```javascript\nconst delegate = (event, context) =\u003e {\n  return {\n    body: 'headers from return value will overwrite default headers if same keys are found',\n    headers: {\n      overwrite: 'from response'\n    }\n  }\n}\nconst defaultHeaders = {\n  overwrite: 'from defaults'\n}\nmodule.exports = {\n  handler: require('agw-lambda-proxy').createHandler(delegate, {headers:defaultHeaders})\n}\n```\n\nIn the example above the response headers will contain value \"from response\" for\nthe header \"overwrite\" as delegate return value headers will take precedence\nover default header values.\n\n\n## Error handling\n\nThe modules handles thrown errors as well as rejections from the delegate\nfunction. These errors are automatically converted to Lamda Proxy Integration\nresponses with appropriate status code. The default error code is 500 but it\ncan be overwritten by specifying **code** attribute on the thrown error or on the\nrejection:\n\n```javascript\nconst delegateThatThrows = (event, context) =\u003e {\n  const error = new Error('message')\n  error.code = 404\n  throw error // or return Promise.reject(error)\n}\n```\n\nThe error message will be set to the \"message\" property of the response. \nThis can be customized by providing an **errorFormatter** function\nin the generator options.\nThe response body contains also a direct link to CloudWatch Logs for\nthis request. Returning the log link can be disabled by setting value **false**\nfor key **cloudWatchLogLinks** in the generator options.\n\n```javascript\nconst delegate = (event, context) =\u003e {\n  //\n}\nconst options = {\n  cloudWatchLogLinks: false,\n  logErrors: true,\n  errorFormatter: (error) =\u003e error.message.substring(0, 20)\n}\nmodule.exports = {\n  handler: require('agw-lambda-proxy').createHandler(delegate, options)\n}\n```\n\n## License\n\n[MIT](LICENSE). Copyright (c) [Olli Vättö](https://github.com/ovatto).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovatto%2Fagw-lambda-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovatto%2Fagw-lambda-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovatto%2Fagw-lambda-proxy/lists"}