Registry / messaging / sqs
library2.0.2jsnpmunverified

A lightweight message queue library for Amazon Simple Queue Service (SQS) in Node.js. Version 2.0.2 provides a simple push/pull API with automatic queue creation, fault tolerance with retries, and env-based configuration. It is a minimal wrapper around AWS SQS, handling message deletion on callback and supporting JSON parsing or raw messages. Not to be confused with the official AWS SDK's SQS client; this is a higher-level abstraction. It lacks recent updates and may have limited support compared to the official SDK.

npm install sqs
INSTALL
IMPORT
SIG · SQS
S
sqs
messagingjavascriptv2.0.2
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.

default (function)
import sqs from 'sqs'; const queue = sqs();
const { sqs } = require('sqs');
The default export is a function, not a named export. In CommonJS, use require('sqs') which returns the function.
default (function, CommonJS)
const sqs = require('sqs'); const queue = sqs();
const { sqs } = require('sqs');
CommonJS export is via module.exports, not named export. The variable name 'sqs' is just your choice.
default (function, ESM)
import sqs from 'sqs'; const queue = sqs();
import { sqs } from 'sqs';
ESM default import is needed; named import will be undefined.

Creates an SQS queue instance with credentials from env vars, pushes a message, and pulls messages.

const sqs = require('sqs'); const queue = sqs({ access: process.env.SQS_ACCESS_KEY || 'ACCESS', secret: process.env.SQS_SECRET_KEY || 'SECRET', region: process.env.SQS_REGION || 'us-east-1' }); queue.push('my-queue', { hello: 'world' }, (err) => { if (err) console.error(err); else console.log('Message pushed'); }); queue.pull('my-queue', (message, callback) => { console.log('Received:', message); callback(); });
Debug
Known issues
gotchaQueue creation occurs on first push if it doesn't exist; may cause delays or require IAM permissions to create queues.
fix
Pre-create queues via AWS console or SDK to ensure consistent configuration (e.g., dead-letter queues).
affects: >=0.0.0
deprecatedPackage uses older AWS SDK v2 patterns and lacks official updates; AWS SDK v3 is the current standard.
fix
Consider migrating to @aws-sdk/client-sqs and implementing your own push/pull logic.
affects: >=0.0.0
gotchaUnless 'raw' option is true, messages are JSON parsed. If non-JSON messages are pushed, parsing will throw.
fix
Set raw: true to receive message body as-is (string).
affects: >=0.0.0
Errors
Common errors & fixes
UnrecognizedClientException: The security token included in the request is invalid.
Invalid or expired AWS credentials.
fix
Verify SQS_ACCESS_KEY and SQS_SECRET_KEY are correct and not expired.
AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist.
Queue not created yet or wrong region.
fix
Ensure queue name exists and region is correct. The library creates queues on push, but may fail if queue name is invalid or permissions missing.
TypeError: Cannot destructure property 'access' of 'undefined' or 'null'.
Importing the module incorrectly in ESM (named import instead of default).
fix
Use default import: import sqs from 'sqs';
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
aws-sdkrequiredUsed to interact with AWS SQS API; must be compatible version.
Agent activity
20 hits · last 30 days
node
16
OpenAI (training)
1
Resources
packagesqs
sqs — npm install sqs · libregistry