Cannot read properties of undefined (reading 'get') when using [email protected] #22
Open
Description
Describe the bug
When using [email protected] package for redis store throws the following error:
"Cannot read properties of undefined (reading 'get')"
Reproduce:
- npm init, run redis server
- npm i http-cache-middleware cache-manager-ioredis restana [email protected]
- run following code from below
- Send http request to one of the endpoints
const CacheManager = require('cache-manager')
const redisStore = require('cache-manager-ioredis')
const redisCache = CacheManager.caching({
store: redisStore,
db: 0,
host: 'localhost',
port: 6379,
ttl: 30
})
const middleware = require('http-cache-middleware')({
stores: [redisCache]
})
const service = require('restana')()
service.use(middleware)
service.get('/cache', (req, res) => {
setTimeout(() => {
res.setHeader('x-cache-timeout', '1 minute')
res.send('this supposed to be a cacheable response')
}, 50)
})
service.delete('/cache', (req, res) => {
res.setHeader('x-cache-expire', '*/cache-*')
res.end()
})
service.start(3000)
Metadata
Metadata
Assignees
Labels
No labels