{"id":23330432,"url":"https://github.com/iopipe/sqs-to-lambda-async","last_synced_at":"2025-06-20T14:11:06.121Z","repository":{"id":57368428,"uuid":"95704754","full_name":"iopipe/sqs-to-lambda-async","owner":"iopipe","description":"Process SQS messages with Lambda, asynchronously","archived":false,"fork":false,"pushed_at":"2018-09-19T13:24:23.000Z","size":50,"stargazers_count":27,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-27T21:16:50.401Z","etag":null,"topics":["async","aws-lambda","lambda","serverless","sqs"],"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/iopipe.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":"2017-06-28T19:34:05.000Z","updated_at":"2021-07-23T06:15:00.000Z","dependencies_parsed_at":"2022-09-05T20:51:18.082Z","dependency_job_id":null,"html_url":"https://github.com/iopipe/sqs-to-lambda-async","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/iopipe/sqs-to-lambda-async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fsqs-to-lambda-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fsqs-to-lambda-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fsqs-to-lambda-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fsqs-to-lambda-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iopipe","download_url":"https://codeload.github.com/iopipe/sqs-to-lambda-async/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fsqs-to-lambda-async/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260959194,"owners_count":23088822,"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":["async","aws-lambda","lambda","serverless","sqs"],"created_at":"2024-12-20T22:18:01.400Z","updated_at":"2025-06-20T14:11:01.103Z","avatar_url":"https://github.com/iopipe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQS to Lambda (Async)\n\n[![CircleCI](https://circleci.com/gh/iopipe/sqs-to-lambda-async.svg?style=svg\u0026circle-token=54579c6f78d8dd9bcc6f96696a8481e7bc007596)](https://circleci.com/gh/iopipe/sqs-to-lambda-async)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\nSo you want to trigger a Lambda function via SQS? Great! You might be able to use [sqs-to-lambda](https://github.com/robinjmurphy/sqs-to-lambda). But what if you want your Lambda function to delete the SQS message, instead of the sqs-to-lambda implementation? Or, what if you want to setup multiple SQS =\u003e Lambda configurations? That's where this package comes in.\n\n## Requirements\n- Node \u003e= `4.3.2`\n- NPM \u003e= `2.14.12`\n\n## Install\n\nWith [yarn](https://yarnpkg.com) (recommended) in project directory:\n```\nyarn add sqs-to-lambda-async\n```\n\nWith npm in project directory:\n```\nnpm install sqs-to-lambda-async\n```\n\nThen, run your application:\n```js\nimport worker from 'sqs-to-lambda-async';\n\nworker([\n  {\n    queueUrl: 'sqs-queue-url-here',\n    functionName: 'lambda-arn-here'\n  }\n]);\n```\n\n## Config\n\nThe package accepts an array of mapping configurations. A mapping configuration is an object with the following properties:\n\n#### `queueUrl` (string: required)\n\nThe SQS queue you want to pull from.\n\n#### `functionName` (string: required)\n\nThe Lambda function you want to execute.\n\n#### `messageFormatter` (function: optional)\n\nA function that allows transformation of the SQS message before send to Lambda.\n\nExample:\n```js\nworker([\n  {\n    queueUrl: 'sqs-queue-url-here',\n    functionName: 'lambda-arn-here',\n    messageFormatter: (msg) =\u003e {\n      return Object.assign({}, msg, {\n        Body: 'reconfigure the sqs body here'\n      })\n    }\n  }\n]);\n```\n\n#### `deleteMessage` (boolean: optional, default = false)\n\nUse this flag to allow this package to delete the message for you, instead of your Lambda function.\n\n#### `maxNumberOfMessages` (integer: optional, default = 5)\n\nThe maximum number of messages to return. [AWS Documenation](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html)\n\n#### `waitTimeSeconds` (integer: optional, default = 5)\n\nThe duration (in seconds) for which the call waits for a message to arrive in the queue before returning. [AWS Documenation](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html)\n\n#### `postInvoke` (function: optional)\n\nOptional callback that is invoked after each lambda invocation. Useful for error handling.\n\nExample:\n```js\nworker([\n  {\n    queueUrl: 'sqs-queue-url-here',\n    functionName: 'lambda-arn-here',\n    postInvoke(err, value){\n      // err will be undefined if lambda invoked successfully\n      // value includes FunctionName and Payload\n    }\n  }\n]);\n```\n\n## Contributing\n- This project uses [Prettier](https://github.com/prettier/prettier). Please execute `npm run eslintFix` to auto-format the code before submitting pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiopipe%2Fsqs-to-lambda-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiopipe%2Fsqs-to-lambda-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiopipe%2Fsqs-to-lambda-async/lists"}