{"id":28229371,"url":"https://github.com/ehmpathy/simple-lambda-client","last_synced_at":"2026-03-08T15:39:00.147Z","repository":{"id":42223727,"uuid":"158732254","full_name":"ehmpathy/simple-lambda-client","owner":"ehmpathy","description":"A simple, convenient way to invoke aws lambda functions with best practices.","archived":false,"fork":false,"pushed_at":"2024-12-31T05:04:10.000Z","size":721,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-08T04:43:10.539Z","etag":null,"topics":["best-practices","client","lambdas"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ehmpathy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-22T17:29:38.000Z","updated_at":"2024-12-31T05:04:02.000Z","dependencies_parsed_at":"2025-01-18T06:30:47.331Z","dependency_job_id":"b4d652d4-ec0f-4e8e-b9e5-d4f9cba32ab9","html_url":"https://github.com/ehmpathy/simple-lambda-client","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"c2bf388498456005f3d218a29cc70b714f6c08ba"},"previous_names":["uladkasach/lambda-service-client","ehmpathy/simple-lambda-client","uladkasach/simple-lambda-client"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/ehmpathy/simple-lambda-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmpathy%2Fsimple-lambda-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmpathy%2Fsimple-lambda-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmpathy%2Fsimple-lambda-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmpathy%2Fsimple-lambda-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehmpathy","download_url":"https://codeload.github.com/ehmpathy/simple-lambda-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmpathy%2Fsimple-lambda-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259759690,"owners_count":22907015,"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":["best-practices","client","lambdas"],"created_at":"2025-05-18T16:10:18.755Z","updated_at":"2026-03-08T15:39:00.086Z","avatar_url":"https://github.com/ehmpathy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-lambda-client\n\n![ci_on_commit](https://github.com/uladkasach/simple-lambda-client/workflows/test/badge.svg)\n![deploy_on_tag](https://github.com/uladkasach/simple-lambda-client/workflows/publish/badge.svg)\n\nA simple, convenient way to invoke aws lambda functions with best practices.\n\nBest practices:\n\n- optional logDebug of input and output\n- throw an error if response contains an error object\n\n# install\n\n```sh\nnpm install --save simple-lambda-client\n```\n\n# use\n\n```ts\nimport { invokeLambdaFunction } from 'simple-lambda-client';\n\nconst service = 'svc-jobs';\nconst stage = getStage();\n\nconst getJobByUuid = (event: { uuid: string }): Promise\u003c{ job: Job | null }\u003e =\u003e\n  invokeLambdaFunction({ service, stage, function: 'getJobByUuid', event });\n\nconst getJobsByPostal = (event: { postal: string }): Promise\u003c{ jobs: Job[] }\u003e =\u003e\n  invokeLambdaFunction({ service, stage, function: 'getJobsByPostal', event });\n\n// ...\n\nexport const svcJobs = {\n  getJobByUuid,\n  getJobsByPostal\n}\n```\n\n# details\n\n### invoke\n\n`simple-lambda-client` exports a function that lets you invoke lambda functions with best practices.\n\nYou can use this function directly if you want...\n\n```ts\nimport { invokeLambdaFunction } from 'simple-lambda-client';\n\nconst result = await invokeLambdaFunction({ service, stage, function, event });\n// ...do amazing things with result...\n```\n\n### type\n\nBut you'll probably want to create a reusable method with typedefs\n\n```ts\nexport const getJobByUuid = (event: { uuid: string }) =\u003e\n  invokeLambdaFunction\u003c{ job: Job | null }\u003e({ service, stage, function: 'getJobByUuid', event });\n```\n\nWhich makes using that a lot easier\n\n```ts\nconst { job } = await getJobByUuid({ uuid: '__uuid__' });\n// ...do amazing things with result...\n```\n\n### namespace\n\nYou may also want to build a full representation of some lambda service under a namespace\n\n```ts\nexport const svcJobs = {\n  getJobByUuid,\n  // ...other methods...\n};\n```\n\nThis adds extra context about \"where\" the methods lambdas invoking is coming from\n\n```ts\nimport { svcJobs } from '../path/to/client';\n\nconst { job } = await svcJobs.getJobByUuid({ uuid: '__uuid__' });\n// ...do amazing things with result...\n```\n\n# features\n\n### errors\n\nWhen this library detects that the lambda you called has thrown an error, it automatically parses it and throws an error of class `LambdaInvocationError`\n\nFor example\n```ts\nimport { invokeLambdaFunction, LambdaInvocationError } from 'simple-lambda-client';\n\ntry {\n  await invokeLambdaFunction({\n    service: 'svc-does-not-exist', // 👈 assume this will cause an error\n    function: 'doAwesomeThing',\n    stage: 'dev',\n    event: {},\n  });\n} catch (error) {\n  expect(error).toBeInstanceOf(LambdaInvocationError) // 👈 error will be an instance of this class\n}\n```\n\n### logging\n\nWhen given a `logDebug` method, this library emits input and output logs with best practices, to make debugging a breeze.\n\nFor example\n```ts\nawait invokeLambdaFunction({\n  service: 'svc-oceans',\n  function: 'cleanup',\n  stage: 'dev',\n  event: {},\n  logDebug: console.log, // 👈 will now emit logs to the console\n});\n```\n\n### caching\n\nWhen given a `cache` instance, this library will wrap the lambda invocation [with-simple-caching](https://github.com/ehmpathy/with-simple-caching)\n\nFor example\n```ts\nimport { createCache } from 'simple-im-memory-cache';\n\nawait invokeLambdaFunction({\n  service: 'svc-oceans',\n  function: 'cleanup',\n  stage: 'dev',\n  event: {},\n  cache: createCache(), // 👈 will now cache the response, with a key of [service, function, stage, event]\n});\n```\n\n\n# tips\n\n### lambda permissions\n\nif you're using this client from inside a lambda, ensure that this lambda has permission to invoke other lambdas\n\n```yml\n# serverless.yml\niamRoleStatements:\n  - Effect: Allow\n    Action:\n      - lambda:InvokeFunction\n      - lambda:InvokeAsync\n    Resource: '*' # TODO: constrain to a specific account, region, service, and stage\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehmpathy%2Fsimple-lambda-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehmpathy%2Fsimple-lambda-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehmpathy%2Fsimple-lambda-client/lists"}