Registry / security / fetch-secret-identifier

fetch-secret-identifier

JSON →
library0.1.0jsnpmunverified

Fetches secrets from AWS Secrets Manager by identifier. Current stable version is 0.1.0. Provides both callback-based `getSecretValue` and Promise-based `getSecretValueAsync` APIs. Lightweight wrapper around the AWS SDK with minimal abstraction. Configured via environment variables (`AWS_ACCESS_KEY`, `AWS_SECRET_KEY`, `AWS_REGION`, `SM_REMOTE`). Suitable for Node.js projects needing quick secret retrieval without full AWS SDK setup, though lacks advanced features like caching or automatic retries.

npm install fetch-secret-identifier
INSTALL
IMPORT
SIG · FETCH-SECRET-IDENT
F
fetch-secret-identifier
securityjavascriptv0.1.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.

fetch-secret-identifier (default)
✓ const sm = require('fetch-secret-identifier');
✗ import sm from 'fetch-secret-identifier';
Package uses CommonJS and does not ship ESM; dynamic import works but is atypical.
getSecretValue
✓ const sm = require('fetch-secret-identifier'); sm.getSecretValue('id', callback);
✗ sm.getSecretValue('id', async (data) => {});
Callback is not promise-based; use getSecretValueAsync for async/await.
getSecretValueAsync
✓ const { getSecretValueAsync } = require('fetch-secret-identifier');
✗ const sm = require('fetch-secret-identifier'); sm.getSecretValueAsync().then();
Named export works with destructuring or direct property access.

Shows both callback and async/await usage to fetch a secret by identifier from AWS Secrets Manager.

const sm = require('fetch-secret-identifier'); // using callback sm.getSecretValue('my-secret-id', (data) => { console.log('Secret:', data); }); // using async/await (async () => { try { const secret = await sm.getSecretValueAsync('my-secret-id'); console.log('Secret:', secret); } catch (err) { console.error('Error:', err); } })();
Debug
Known issues
gotchaRequires environment variables AWS_ACCESS_KEY and AWS_SECRET_KEY; missing them causes silent failures.
fix
Set both environment variables before calling any function.
affects: >=0.0.0
gotchaSM_REMOTE=true is needed to actually call AWS Secrets Manager; default behavior may be local fallback or no-op.
fix
Set SM_REMOTE=true in environment when deploying to AWS.
affects: >=0.0.0
breakingNo TypeScript type definitions shipped; TypeScript users will get implicit any.
fix
Create manual .d.ts or use `@ts-ignore`.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: sm.getSecretValue is not a function
Importing incorrectly (e.g., using ESM import syntax without transpilation).
fix
Use const sm = require('fetch-secret-identifier');
Missing region in config
AWS_REGION environment variable not set.
fix
Set AWS_REGION=us-west-2 (or your region) in environment.
AccessDeniedException: User: arn:aws:iam::xxx is not authorized to perform: secretsmanager:GetSecretValue
AWS credentials lack permissions for the secret.
fix
Attach AWSSecretsManagerReadWrite policy to the IAM user/role.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
aws-sdkrequiredRequired to interact with AWS Secrets Manager API
Agent activity
20 hits · last 30 days
node
18
Amazon
1
Resources
fetch-secret-identifier — npm install fetch-secret-identifier · libregistry