sqs-producer is a Node.js library for enqueuing messages onto Amazon SQS queues. Current stable version is 9.0.5, requiring Node >=22. It is a peer dependency of @aws-sdk/client-sqs v3.1036+. The library provides a simple Producer class that handles batching, message formatting, and queue size retrieval. It natively supports both standard and FIFO queues, including groupId/deduplicationId for FIFO and fair queue behavior for multi-tenant scenarios. Ships TypeScript definitions, ESM-only (no CJS), and is maintained by BBC. Differentiators: minimal API surface, no native dependencies, explicit FIFO support, and fair queue integration.
npm install sqs-producerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic producer creation and message sending with SQS, including single, batch, and attribute-enriched messages.
Switch to import syntax. If you must use require, use dynamic import or stay on v8.x.
Upgrade Node.js to v22 or later, or use an older version of sqs-producer that supports your Node version.
Wrap send() calls in try/catch and implement exponential backoff/retry logic in your application.
Ensure that every message sent to a FIFO queue includes groupId and deduplicationId (or enable content-based deduplication on the queue).
Replace new Producer(options) with Producer.create(options).
Convert to ES module (add "type": "module" in package.json) and use import { Producer } from 'sqs-producer'. Alternatively, use dynamic import: const { Producer } = await import('sqs-producer');Use named import: import { Producer } from 'sqs-producer';Add groupId and deduplicationId to each message object. For example: { id: '1', body: 'msg', groupId: 'group1', deduplicationId: 'hash1' }.Ensure each message object has a body field. For string messages, the body is the string itself. For objects, provide body: 'your message'.