Cannot read property 'length' of undefined in node_redis hgetall function

I have the following code generating the error:

leagueclient.hgetall userLeagueKey, getLeagueInfo

I've verified that the key is correct, and getLeagueInfo executes correctly with the correct return value, but in between I get the Cannot read property 'length' of undefined. Debug says it's in hgetall.

I turned on debug messages in node_redis

send 127.0.0.1:6379 id 2: *2
$7
hgetall
$14
userLeagueId:0

send_command buffered_writes: 0  should_buffer: false
true
Cannot read property 'length' of undefined
net read 127.0.0.1:6379 id 2: *6
$11
challengeId
$1
0
$10
leagueName
$5
Oatmo
$22
currentDiscussionEntry
$1
2

So the error happens after sending the request and getting the result.

Any idea what could be creating the error, and alternatively the best way to debug it?

The problem here turned out to be trying to return results from the function instead of passing the results via a callback. I'm sure this is a common problem for new programmers using node, so I thought I would mention it. All functions which depend on external accesses must work with a callback.