{"id":19151424,"url":"https://github.com/sc5/lambda-server","last_synced_at":"2026-06-14T11:30:15.947Z","repository":{"id":143884903,"uuid":"44800113","full_name":"SC5/lambda-server","owner":"SC5","description":"Module for providing generic initialization of Lambda functions (e.g. Cloudformation stack name into env variable)","archived":false,"fork":false,"pushed_at":"2016-01-12T11:07:28.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-03T20:50:29.763Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SC5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-23T08:19:52.000Z","updated_at":"2016-07-27T11:30:38.000Z","dependencies_parsed_at":"2023-03-25T13:48:57.285Z","dependency_job_id":null,"html_url":"https://github.com/SC5/lambda-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Flambda-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Flambda-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Flambda-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Flambda-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SC5","download_url":"https://codeload.github.com/SC5/lambda-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240236233,"owners_count":19769573,"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":"2024-11-09T08:14:40.519Z","updated_at":"2026-06-14T11:30:15.901Z","avatar_url":"https://github.com/SC5.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lambda-server NPM module\n\nA module for providing some basic services to serverles services implemented by AWS Lambda.\nFor the time being, the server only intitializes a the STACK_NAME environment variable to contain the Cloudformation stack name (based on the function name, e.g. ABC-functionName-123456 =\u003e STACK_NAME=ABC). More logic can and will be added later.\n\n## Usage\n\nPackage your lambda function into a module lambdaFunction.js with syntax\n```javascript\n  var lambdaServer;\n\n  function init(server) {\n      lambdaServer = server;\n  }\n\n  function handleRequest(event, cb) {\n      if (ERROR) {\n          cb(ERROR MESSAGE HERE)\n      } \n      console.log('I am in CloudFormation stack ' + process.env.STACK_NAME);\n\n      cb(null, {\n          ... YOUR RESPONSE OBJECT HERE\n      });\n  }\n\n  module.exports = exports = {\n      init: init,\n      handleRequest: handleRequest\n  };\n```\n\nThe index.js for your lambda-server based service would be e.g.\n\n```javascript\n  var server = require('lambda-server');\n  var lambdaFunction = require('./lambdaFunction.js');\n\n  server.init({\n      lambdaFunction: lambdaFunction \n  });\n\n  module.exports = exports = {\n      handler : server.handler\n  };\n```\n\nAn alternative error handler can be registered (e.g. for logging / notifications) by passing the error handler function in 'errorHandler' during lambda-server-init. e.g.\n\n```javascript\n  var server = require('lambda-server');\n  var lambdaFunction = require('./lambdaFunction.js');\n  var myErrorHandler = function(error, callback) {\n    call_your_logging_function_here(error, callback);\n  }\n\n  server.init({\n      lambdaFunction: lambdaFunction,\n      errorHandler: myErrorHandler\n  });\n\n  module.exports = exports = {\n      handler : server.handler\n  };\n```\n\n## TODO\n\nIdeas for future versions:\n\n1. hook for keeping the function awake triggered via scheduled event \n2. generic method to manage configuration data for Lambda-based services \n3. functions to ease deployment to Lambda\n\n## Release History\n\n* 2016/01/12 - v0.9.2 - Invoke errorHandler also on Exceptions\n* 2015/11/30 - v0.9.1 - Added capability to register alternative error Handler\n* 2015/10/23 - v0.9.0 - Initial version of module\n\n## License\n\nCopyright (c) 2015 [SC5](http://sc5.io/), licensed for users and contributors under MIT license.\nhttps://github.com/SC5/lambda-server/blob/master/LICENSE\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/SC5/lambda-server/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc5%2Flambda-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsc5%2Flambda-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc5%2Flambda-server/lists"}