Registry / storage / hono-sessions-redis

hono-sessions-redis

JSON →
library1.1.1jsnpmunverified

Redis session store connector for hono-sessions, forked from connect-redis-hono. Version 1.1.1, actively maintained. It provides a RedisStoreAdapter class that integrates with hono-sessions middleware to store session data in Redis. Only compatible with ioredis client. Different from alternatives like connect-redis-hono by being tailored for Hono framework and hono-sessions package.

npm install hono-sessions-redis
INSTALL
IMPORT
SIG · HONO-SESSIONS-REDI
H
hono-sessions-redis
storagejavascriptv1.1.1
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.

RedisStoreAdapter
import { RedisStoreAdapter } from 'hono-sessions-redis'
const RedisStoreAdapter = require('hono-sessions-redis')
ESM-only package; named export.
default
import { RedisStoreAdapter } from 'hono-sessions-redis'
import RedisStoreAdapter from 'hono-sessions-redis'
No default export; only named export available.
RedisStoreAdapter
import { RedisStoreAdapter } from 'hono-sessions-redis'
import Redis from 'hono-sessions-redis'
Wrong symbol name; export is exactly RedisStoreAdapter.

Basic setup of Hono app with session middleware using RedisStoreAdapter and ioredis client.

import { Hono } from 'hono'; import { sessionMiddleware } from 'hono-sessions'; import { RedisStoreAdapter } from 'hono-sessions-redis'; import Redis from 'ioredis'; const redisClient = new Redis({ host: 'localhost', port: 6379 }); const store = new RedisStoreAdapter({ prefix: 'Session:', ttl: 3600, client: redisClient, }); const app = new Hono(); app.use('*', sessionMiddleware({ store })); app.get('/', (c) => c.text('Hello')); export default { port: 3000, fetch: app.fetch };
Debug
Known issues
breakingOnly compatible with ioredis; redis v4+ not supported
fix
Use ioredis instead of node-redis or other clients.
affects: <=1.1.1
deprecatedPrefix option may be removed in future versions
fix
Use keyPrefix in session middleware if needed.
affects: 1.x
gotchaTTL is in seconds, not milliseconds
fix
Ensure ttl value is in seconds.
affects: >=1.0.0
gotchaRedis client must be fully connected before creating store
fix
Wait for Redis client 'ready' event before using store.
affects: >=1.0.0
breakingFork from connect-redis-hono; API differences may exist
fix
Refer to hono-sessions-redis documentation, not connect-redis-hono.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: RedisStoreAdapter is not a constructor
Importing default export instead of named export
fix
Use `import { RedisStoreAdapter } from 'hono-sessions-redis'`
ERR_INVALID_ARG_TYPE: The "client" argument must be an instance of Redis
Passing client that is not from ioredis
fix
Use `import Redis from 'ioredis'` and instantiate correctly.
Error: Prefix is not allowed to be empty
Omitting prefix option in RedisStoreAdapter constructor
fix
Provide a prefix string (e.g., prefix: 'Session:')
Module "hono-sessions-redis" has no default export
Attempting default import
fix
Use named import `{ RedisStoreAdapter }`
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
ioredisrequiredRequired to create Redis client instance used in RedisStoreAdapter
hono-sessionsrequiredPeer dependency for session middleware integration
Agent activity
20 hits · last 30 days
node
20
Resources
hono-sessions-redis — npm install hono-sessions-redis · libregistry