Registry / messaging / sqs-queue-processor

sqs-queue-processor

JSON →
library1.0.0jsnpmunverified

An event-based AWS SQS queue processor library for Node.js (v1.0.0, stable). It provides long polling with customizable options, emits events for message processing lifecycle (start, stop, before_poll, after_poll, message, error), and supports custom message parsing. Differentiators: simple event-driven API, no external dependencies beyond AWS SDK, and automatic long polling. Ideal for lightweight SQS message consumption without full framework overhead.

npm install sqs-queue-processor
INSTALL
IMPORT
SIG · SQS-QUEUE-PROCESSO
S
sqs-queue-processor
messagingjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QueueProcessor
const QueueProcessor = require('sqs-queue-processor')
import QueueProcessor from 'sqs-queue-processor'
CJS-only package. ES import will fail.

Creates a QueueProcessor, attaches message and error event handlers, and starts polling the SQS queue.

const QueueProcessor = require('sqs-queue-processor'); const processor = new QueueProcessor({ queueUrl: process.env.QUEUE_URL ?? 'https://sqs.us-east-1.amazonaws.com/12345678910/MyQueueUrl', awsRegion: process.env.AWS_REGION ?? 'us-east-1' }); processor.on('message', (msg) => { console.log('Received:', msg.Body); // Process and then delete message // auto-delete not provided; you must call sqs.deleteMessage() }); processor.on('error', (err) => console.error('Error:', err)); processor.start();
Debug
Known issues
gotchaThe library does not automatically delete messages after processing. You must manually call sqs.deleteMessage() after successful processing or messages will be reprocessed after VisibilityTimeout expires.
fix
In the 'message' event handler, call sqs.deleteMessage({ QueueUrl, ReceiptHandle: msg.ReceiptHandle }).promise()
affects: >=1.0.0
gotchaThe onMessageParse option mutates the original message object instead of returning a new one. If you need the original message, clone it inside the parser.
fix
Use onMessageParse: function(msg) { return { ...msg, Body: JSON.parse(msg.Body) }; }
affects: >=1.0.0
deprecatedThe package uses the legacy AWS SDK v2. You must install aws-sdk separately. AWS SDK v3 is not supported.
fix
npm install aws-sdk@2.x
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'sqs-queue-processor'
Package not installed or import path incorrect.
fix
Run 'npm install sqs-queue-processor' and use require('sqs-queue-processor')
TypeError: QueueProcessor is not a constructor
Using ES 'import' with this CJS-only package.
fix
Use const QueueProcessor = require('sqs-queue-processor');
The queue url is invalid.
Missing queueUrl option or invalid URL format.
fix
Provide a valid SQS queue URL: https://sqs.<region>.amazonaws.com/<account-id>/<queue-name>
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
sqs-queue-processor — npm install sqs-queue-processor · libregistry