Registry / devops / connect-migration-store

connect-migration-store

JSON →
library1.1.4jsnpmunverified

A session store wrapper for Express/Connect that enables zero-downtime migration from one session store to another. Version 1.1.4 is the current stable release with low release cadence. It wraps two stores (e.g., Redis and DynamoDB) and transparently forwards reads and writes to both during migration. Unlike manual migration scripts, it preserves user sessions without forced logout. ESM-only not supported; CommonJS only.

npm install connect-migration-store
INSTALL
IMPORT
SIG · CONNECT-MIGRATION-
C
connect-migration-store
devopsjavascriptv1.1.4
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.

MigrationStore
const MigrationStore = require('connect-migration-store')(session);
const MigrationStore = require('connect-migration-store');
The package exports a function that must be called with the session module (express-session). CommonJS only; no ESM support.
SessionStore
const store = new MigrationStore({from: originalStore, to: newStore});
const store = new MigrationStore();
Constructor requires an object with 'from' and 'to' store instances.

Creates a MigrationStore wrapping Redis (original) and DynamoDB (new) stores, using it with express-session middleware.

const express = require('express'); const session = require('express-session'); const RedisStore = require('connect-redis')(session); const DynamoDBStore = require('connect-dynamodb')({session}); const MigrationStore = require('connect-migration-store')(session); const app = express(); const redisStore = new RedisStore({ url: process.env.REDIS_URL ?? 'redis://localhost:6379' }); const dynamoStore = new DynamoDBStore({ table: process.env.DYNAMODB_TABLE ?? 'sessions' }); const migrationStore = new MigrationStore({ from: redisStore, to: dynamoStore }); app.use(session({ store: migrationStore, secret: 'your-secret', resave: false, saveUninitialized: false })); app.get('/', (req, res) => { res.send('Session migrated!'); }); app.listen(3000);
Debug
Known issues
gotchaThe require('connect-migration-store') returns a function that must be called with the session module, not the store constructor directly.
fix
Use require('connect-migration-store')(session) to get the store class.
affects: *
gotchaBoth 'from' and 'to' stores must implement the Express session store API (get, set, destroy, etc.). Incompatible stores may cause silent failures.
fix
Ensure both stores are from express-session compatible packages (e.g., connect-redis, connect-dynamodb).
affects: *
gotchaThis package is CommonJS-only; it does not provide ESM exports. Using import in an ESM project will fail.
fix
Use require() or dynamic import with createRequire.
affects: *
Errors
Common errors & fixes
TypeError: MigrationStore is not a constructor
The required module is a function that must be called with the session module first.
fix
const MigrationStore = require('connect-migration-store')(session);
Error: Cannot find module 'connect-migration-store'
Package not installed or typo in package name.
fix
npm install connect-migration-store
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
connect-migration-store — npm install connect-migration-store · libregistry