Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when key doesn't exist #76

Closed
dustinmartin opened this issue Sep 29, 2016 · 2 comments
Closed

Error when key doesn't exist #76

dustinmartin opened this issue Sep 29, 2016 · 2 comments

Comments

@dustinmartin
Copy link

Inside of get.js, line 43, hgetall is used to get a value from redis. It doesn't handle the case when the key doesn't exist. If the key doesn't exist then result is null which results in the below error being thrown. It looks like keys is used to check if the key exists but it could expire or be deleted in between the time that keys is called and hgetall is called.

TypeError: Cannot set property 'name' of null
    at Command.<anonymous> (/Users/dustinmartin/Projects/api/node_modules/express-redis-cache/lib/ExpressRedisCache/get.js:45:27)
    at intercepted (domain.js:251:14)
    at Command.runIntercepted (domain.js:265:12)
    at Command.nrWrappedHandler (/Users/dustinmartin/Projects/api/node_modules/newrelic/lib/transaction/tracer/index.js:398:19)
    at Command.wrapped (/Users/dustinmartin/Projects/api/node_modules/newrelic/lib/transaction/tracer/index.js:182:28)
    at Command.wrappedCallback (/Users/dustinmartin/Projects/api/node_modules/newrelic/lib/transaction/tracer/index.js:450:66)
    at Command.wrapped (/Users/dustinmartin/Projects/api/node_modules/newrelic/lib/transaction/tracer/index.js:182:28)
    at bound (domain.js:280:14)
    at Command.runBound (domain.js:293:12)
    at normal_reply (/Users/dustinmartin/Projects/api/node_modules/redis/index.js:662:21)
    at RedisClient.return_reply (/Users/dustinmartin/Projects/api/node_modules/redis/index.js:722:9)
    at JavascriptReplyParser.RedisClient.reply_parser.Parser.returnReply (/Users/dustinmartin/Projects/api/node_modules/redis/index.js:146:18)
    at JavascriptReplyParser.run (/Users/dustinmartin/Projects/api/node_modules/redis-parser/lib/javascript.js:137:18)
    at JavascriptReplyParser.execute (/Users/dustinmartin/Projects/api/node_modules/redis-parser/lib/javascript.js:112:10)
    at Socket.<anonymous> (/Users/dustinmartin/Projects/api/node_modules/redis/index.js:223:27)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:172:18)
    at Socket.Readable.push (_stream_readable.js:130:10)
    at TCP.onread (net.js:542:20)
[nodemon] app crashed - waiting for file changes before starting...
@dustinmartin
Copy link
Author

I've created this PR to fix this issue: #77

@krazyjakee
Copy link
Collaborator

#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants