Registry / storage / connect-cloudant-store

connect-cloudant-store

JSON →
library1.0.0jsnpmunverified

Express session storage connector for IBM Cloudant. Version 1.0.0 (latest) provides a Cloudant-backed session store for express-session, with support for TTL, auto-cleanup of expired sessions, and integration with Bluemix/Cloud Foundry via VCAP_SERVICES. It wraps the official cloudant npm module. Minimal dependencies: express-session and cloudant. Not actively maintained; no updates since 2018.

npm install connect-cloudant-store
INSTALL
IMPORT
SIG · CONNECT-CLOUDANT-S
C
connect-cloudant-store
storagejavascriptv1.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.

CloudantStore
var CloudantStore = require('connect-cloudant-store')(session);
var CloudantStore = require('connect-cloudant-store');
The module exports a function that takes the session module and returns a store constructor. Do not import directly without passing session.
CloudantStore instance
var store = new CloudantStore({ url: 'https://user:pass@host.cloudant.com' });
var store = new CloudantStore();
The constructor requires options; at minimum a url or client. Missing options will cause connection errors.
Default import (not applicable)
N/A
import CloudantStore from 'connect-cloudant-store';
This package does not support ES module imports; it uses CommonJS. Use require().

Shows how to initialize the Cloudant session store with explicit credentials and attach to express-session.

var session = require('express-session'); var CloudantStore = require('connect-cloudant-store')(session); var store = new CloudantStore({ url: 'https://' + process.env.CLOUDANT_USER + ':' + process.env.CLOUDANT_PASS + '@' + process.env.CLOUDANT_HOST }); store.on('connect', function() { console.log('Cloudant store connected'); }); var app = require('express')(); app.use(session({ store: store, secret: 'keyboard cat', resave: false, saveUninitialized: false })); app.get('/', function(req, res) { res.send('Session test'); }); app.listen(3000);
Debug
Known issues
breakingDatabase 'sessions' must be created manually before using the store; it is not auto-created.
fix
Create a database named 'sessions' in your Cloudant instance before starting the app.
affects: >=1.0.0
gotchaThe package does not support ES module imports (ESM). Using import will fail.
fix
Use require() instead of import.
affects: >=1.0.0
gotchaWhen using vcapServices option, the package may fail on Bluemix Dedicated because it does not search by service name first.
fix
Use cfenv to get credentials and pass a url instead, or manually extract the service URL.
affects: >=1.0.0
deprecatedThe cloudant npm module (v1) is deprecated in favor of @cloudant/cloudant. This package uses the deprecated cloudant module.
fix
Consider switching to a more modern session store like connect-couchdb or using @cloudant/cloudant directly with a custom store.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'cloudant'
The cloudant peer dependency is not installed.
fix
Run 'npm install cloudant' alongside connect-cloudant-store.
TypeError: CloudantStore is not a constructor
The module export is a function that must be called with session. Direct require() returns a function, not a constructor.
fix
Use: var CloudantStore = require('connect-cloudant-store')(session);
Error: connect ECONNREFUSED ... cloudant.com:443
Invalid or missing Cloudant URL; connection refused.
fix
Verify your Cloudant credentials and ensure the URL is correct, e.g., https://user:pass@host.cloudant.com
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
express-sessionrequiredpeer dependency; the store is used as a session store for express-session
cloudantrequiredruntime dependency; wraps Cloudant npm module for database operations
Agent activity
23 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources
connect-cloudant-store — npm install connect-cloudant-store · libregistry