{"id":27948526,"url":"https://github.com/expressgateway/express-gateway-plugin-lambda","last_synced_at":"2025-05-07T14:59:17.222Z","repository":{"id":34299714,"uuid":"152310639","full_name":"ExpressGateway/express-gateway-plugin-lambda","owner":"ExpressGateway","description":"Proxy to AWS Lambda functions with Express Gateway","archived":false,"fork":false,"pushed_at":"2022-12-30T17:18:33.000Z","size":1893,"stargazers_count":4,"open_issues_count":21,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T14:59:11.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ExpressGateway.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}},"created_at":"2018-10-09T19:39:49.000Z","updated_at":"2020-09-07T07:38:50.000Z","dependencies_parsed_at":"2023-01-15T06:04:56.813Z","dependency_job_id":null,"html_url":"https://github.com/ExpressGateway/express-gateway-plugin-lambda","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressGateway%2Fexpress-gateway-plugin-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressGateway%2Fexpress-gateway-plugin-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressGateway%2Fexpress-gateway-plugin-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressGateway%2Fexpress-gateway-plugin-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ExpressGateway","download_url":"https://codeload.github.com/ExpressGateway/express-gateway-plugin-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252902605,"owners_count":21822258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-05-07T14:59:16.441Z","updated_at":"2025-05-07T14:59:17.207Z","avatar_url":"https://github.com/ExpressGateway.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm][npm-version-badge]][npm-package-url]\n[![CircleCI][circleci-badge]][circleci-master-url]\n[![Gitter][gitter-badge]][gitter-room-url]\n\n# Express Gateway AWS Lambda Plugin\n\n## Proxy to AWS Lambda functions with Express Gateway\n\n### Plugin Settings\n\n* `invocationType` - [`RequestResponse` _(default)_ | `Event` | `DryRun`] - AWS Lambda invocation type.\n* `logType` - [`None` _(default)_ | `Tail`] - AWS Lambda log type.\n* `unhandledStatus` - [default: `500`] - When the Lambda function returns with an unhandled error, usually due to an absence of available resources, this status code will be returned to the client.\n* `useCustomIntegration` - [true | false _(default)_] - Use a custom integration as specified by the `req.egContext.lambda` object.\n* `maxJSONParseLength` - [_(default: 5 * 1.049e+6, 5MiB)_] - Maximum number of bytes to allow for parsing responses as JSON in an attempt to guess the MIME type.\n\n## `lambda-proxy` Policy\n\n### Policy Settings\n\nAll plugin settings can be overridden on a per-policy basis.  In addition, here are some policy-specific settings:\n\n* `functionName` - [_(required)_] - Specify the Lambda function name or ARN.\n* `qualifier` - [_(optional)_] - Specify a Lambda function version or alias name.\n* `ignorePath`- [true | false _(default)_, _(optional, only valid when using Proxy Integration)_] - Don't proxy to the incoming request's URL path.\n* `stripPath` - [true | false _(default)_, _(optional, only valid when using Proxy Integration)_] - Strip the API Endpoint path prefix from the forwarded URL path.\n\n### Integration Modes\n\n#### Proxy Integration\n\nProxy Integration mode sends the Lambda function an event that looks similar to an AWS API Gateway event.  The response is expected to be in the same format as the AWS API Gateway Lambda response.\n\n##### Proxy Integration Lambda Event\n\nWith Proxy Integration mode, the HTTP request gets turned into a JSON object that gets invoked with the Lambda function.\n\nHere's an example:\n\n```json\n{\n  \"httpMethod\": \"POST\",\n  \"path\": \"/California?name=Kevin\",\n  \"resource\": \"/:proxy\",\n  \"queryStringParameters\": {\n    \"name\": \"Kevin\"\n  },\n  \"pathParameters\": {\n    \"proxy\": \"California\"\n  },\n  \"headers\": {\n    \"host\": \"localhost:60852\",\n    \"user-agent\": \"curl/7.51.0\",\n    \"accept\": \"*/*\",\n    \"content-type\": \"application/json\",\n    \"day\": \"Thursday\",\n    \"content-length\": \"18\"\n  },\n  \"requestContext\": {\n    \"apiEndpoint\": {\n      \"apiEndpointName\": \"default\",\n      \"host\": \"*\",\n      \"path\": \"/:proxy\",\n      \"paths\": \"/:proxy\",\n      \"scopes\": []\n    },\n    \"resourcePath\": \"/:proxy\",\n    \"httpMethod\": \"POST\",\n    \"requestId\": \"3SpeBYb8SK6CvH7Ipx56pK\"\n  },\n  \"isBase64Encoded\": false,\n  \"body\": \"{\\\"time\\\":\\\"morning\\\"}\"\n}\n```\n\n##### Proxy Integration Lambda Response\n\nThe Lambda response must use the following JSON structure:\n\n```json\n{\n    \"isBase64Encoded\": true|false,\n    \"statusCode\": httpStatusCode,\n    \"headers\": { \"headerName\": \"headerValue\", ... },\n    \"body\": \"...\"\n}\n```\n\nIf no `Content-Type` header is provided, this plugin will take a buest guess at the MIME type before sending the response to the client.  It is recommended to always include a `Content-Type` header.\n\n#### Custom Integration\n\nRequires the setting `useCustomIntegration` to equal `true`.\n\nCustom Integration Mode takes a look at the `req.egContext.lambda` object and forwards that as the incoming event to the AWS Lambda function.  The response is taken, the content type is guessed, and it finally returns to the client.\n\nIf the `req.egContext.lambda` object is not populated, a default event structure will be sent to the AWS Lambda function.  Example:\n\n```json\n{\n  \"method\": \"POST\",\n  \"path\": \"/California?name=Kevin\",\n  \"headers\": {\n    \"host\": \"localhost:61636\",\n    \"user-agent\": \"curl/7.51.0\",\n    \"accept\": \"*/*\",\n    \"content-type\": \"application/json\",\n    \"day\": \"Thursday\",\n    \"content-length\": \"18\"\n  },\n  \"body\": \"{\\\"time\\\":\\\"morning\\\"}\"\n}\n```\n\nThis plugin will attempt a best guess at the `Content-Type` of the response.  It is recommended to use Proxy Integration whenever possible.\n\n## Installation\n\n```\neg plugin install express-gateway-plugin-lambda\n```\n\nor refer to [Plugin installation guide][plugin-install-guide]\n\n## Credentials \u0026 Config\n\nThis plugin follows conventions for credentials defined by the AWS Node.js SDK. See [Setting Credentials in Node.js][aws-sdk-creds] for more information.\n\nWhen using your shared, local AWS config file (for `region` etc.), make sure you set the `AWS_SDK_LOAD_CONFIG` environment variable to a truthy value. Also, see [Configuration and Credential Files][aws-sdk-config]\n\nExample:\n\n```\nAWS_SDK_LOAD_CONFIG=true npm start\n```\n---\n### Debugging:\nIf you get `Internal Server Error` from plugin, you can see the extended logs by doing:\n```\nDEBUG=express-gateway-plugin-lambda:* npm start\n```\n\n## License\n\n[Apache-2.0 License][apache-license]\n\nCopyright © LunchBadger, Inc. and Contributors\n\n[apache-license]: https://github.com/expressgateway/express-gateway-plugin-lambda/blob/master/LICENSE\n[npm-version-badge]: https://img.shields.io/npm/v/express-gateway-plugin-lambda.svg\n[npm-package-url]: https://www.npmjs.com/package/express-gateway-plugin-lambda\n[circleci-badge]: https://circleci.com/gh/ExpressGateway/express-gateway-plugin-lambda/tree/master.svg?style=shield\u0026circle-token=45cb3093e78cb81947f2adba9ca877acdbb2eb4e\n[circleci-master-url]: https://circleci.com/gh/ExpressGateway/express-gateway-plugin-lambda/tree/master\n[gitter-badge]: https://img.shields.io/gitter/room/expressgateway/express-gateway.svg\n[gitter-room-url]: https://gitter.im/ExpressGateway/express-gateway\n[aws-sdk-creds]: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html\n[aws-sdk-config]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html\n[plugin-install-guide]: https://www.express-gateway.io/docs/cli/plugins/install/#description","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpressgateway%2Fexpress-gateway-plugin-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpressgateway%2Fexpress-gateway-plugin-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpressgateway%2Fexpress-gateway-plugin-lambda/lists"}