Node.js redis "unknown command 'hset'"? - node.js

I'm new to redis, and I'm trying out various examples. However, it doesn't seem to work:
root#localhost:~# node lol.js
Reply: OK
Error: Error: Error: ERR unknown command 'hset'
Error: Error: Error: ERR unknown command 'hset'
/root/node_modules/redis/index.js:468
throw callback_err;
^
TypeError: Cannot read property 'length' of undefined
at Command.callback (/root/lol.js:15:28)
at RedisClient.return_error (/root/node_modules/redis/index.js:464:25)
at HiredisReplyParser.<anonymous> (/root/node_modules/redis/index.js:253:14)
at HiredisReplyParser.emit (events.js:67:17)
at HiredisReplyParser.execute (/root/node_modules/redis/lib/parser/hiredis.js:41:18)
at RedisClient.on_data (/root/node_modules/redis/index.js:440:27)
at Socket.<anonymous> (/root/node_modules/redis/index.js:70:14)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:367:14)
I'm using one of the example scripts on the github page for node-redis. I'm on Debian Squeeze.

The main problem is not with your code (of course it could recognize the error sent by the server) or with the node redis module but with the Redis server.
You need to upgrade it to a newer version, HSET command is supported since version 2.0.0.

Related

Error invoking chaincode using Node.js SDK [TypeError: Cannot read property 'getConnectivityState' of undefined]

Failed to invoke successfully :: TypeError: Cannot read property 'getConnectivityState' of undefined
/opt/share/hyperledger/node_modules/fabric-client/lib/EventHub.js:355
if(self._stream) state = self.stream.call.channel.getConnectivityState();
^
TypeError: Cannot read property 'getConnectivityState' of undefined
at ClientDuplexStream.<anonymous> (/opt/share/hyperledger/node_modules/fabric-client/lib/EventHub.js:355:56)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at ClientDuplexStream._emitStatusIfDone (/opt/share/hyperledger/node_modules/grpc/src/client.js:236:12)
at ClientDuplexStream._readsDone (/opt/share/hyperledger/node_modules/grpc/src/client.js:201:8)
at /opt/share/hyperledger/node_modules/grpc/src/client_interceptors.js:705:15
I am using latest version of pre-requisites as mentioned in below link:
http://hyperledger-fabric.readthedocs.io/en/release-1.1/getting_started.html#install-prerequisites
Can anybody tell me where am i going wrong?
Yes, this is due to a new version of grpc released 3 days ago (v1.11.0). The version is controlled by fabric-client and it takes the latest available. You need to delete the grpc module and reinstall it with npm install grpc#1.9.1. This will fix the issue. Going forward you may need to have grpc fixed at 1.9.1 in your package.json until Hyperledger resolve this issue.
Reference:
https://chat.hyperledger.org/channel/general?msg=FME6aDfnfMexWTm6g
I commented these lines in EventHub.js.
It's required only for state log.
For example:
<br/>
<i> var state = -1;<br/>
//if(self._stream) state = self._stream.call.channel_.getConnectivityState();<br/>
logger.debug('on.data - grpc stream state :%s',state);<br/>
</i><br/><br/>
it works fine now.
I'm still getting below error after commenting the line in EventHub.js
Failed to invoke successfully :: TypeError: Cannot read property 'getConnectivityState' of undefined
Previous detailed error:
TypeError: Cannot read property 'getConnectivityState' of undefined
at ClientDuplexStream. (/fabric-samples/fabcar/node_modules/fabric-client/lib/EventHub.js:308:56)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at ClientDuplexStream.Readable.push (_stream_readable.js:208:10)
at Object.onReceiveMessage (/fabric-samples/fabcar/node_modules/grpc/src/client_interceptors.js:1302:19)
at InterceptingListener.recvMessageWithContext (/fabric-samples/fabcar/node_modules/grpc/src/client_interceptors.js:629:19)
at /fabric-samples/fabcar/node_modules/grpc/src/client_interceptors.js:728:14
Faced the same issue while building the web docker
edit package.json
add the line
"dependencies": {
"grpc" : "1.9.1",
build the docker again
issue the docker compose agin ! it works
I was trying to connect the composer bna to IBM blockchain, and I tried out installing grpc 1.9.1.. and even 1.10.1.. I tried out like everything, and the only thing that worked was doing as Kataus suggested, I commented out the lines relate to the getConnectivity state, and it finally connected to the IBM blockchain network I had.

error: A hook (`userconfig`) failed to load

after npm install , getting error like, i have checked every config file and also installed lodash manually after but still not working
error: A hook (`userconfig`) failed to load!
error: Error: In Sails v1.x, `sails.config.globals._` must be either `false` or an object (typically the value of `require('lodash')`)
at Sails.exposeGlobals (D:\Node_Project\POS\trunk\node_modules\sails\lib\app\private\exposeGlobals.js:47:44)
at Sails.wrapper [as exposeGlobals] (D:\Node_Project\POS\trunk\node_modules\#sailshq\lodash\lib\index.js:3250:19)
at emitNone (events.js:91:20)
at Sails.emit (events.js:185:7)
at Sails.emitter.emit (D:\Node_Project\POS\trunk\node_modules\sails\lib\app\private\after.js:50:11)
at D:\Node_Project\POS\trunk\node_modules\sails\lib\app\private\loadHooks.js:111:15
at Hook.initialize (D:\Node_Project\POS\trunk\node_modules\sails\lib\hooks\index.js:154:14)
at Hook.wrapper [as initialize] (D:\Node_Project\POS\trunk\node_modules\#sailshq\lodash\lib\index.js:3250:19)
at D:\Node_Project\POS\trunk\node_modules\sails\lib\hooks\index.js:88:16
at D:\Node_Project\POS\trunk\node_modules\sails\node_modules\async\dist\async.js:486:20
First : Make sure you've installed dependencies with npm install
Second : Check that this app was built for a compatible version of Sails.

How to troubleshoot ECONNREFUSED error?

I'm trying to get the d3.js demo given here to work.
I'm following along the instructions in the README.md file. I get the npm install step to work, but the next step, node server, fails:
% node server
Master pid 16196
16197 listening. Go to: http://localhost:3030/
events.js:72
throw er; // Unhandled 'error' event
^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
at RedisClient.on_error (/Users/yrstruly/tmp/derby-barchart/node_modules/redis/index.js:189:24)
at Socket.<anonymous> (/Users/yrstruly/tmp/derby-barchart/node_modules/redis/index.js:95:14)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:440:14
at process._tickCallback (node.js:415:13)
It looks like the code is expecting to have some process listening to port 6379, but the README says nothing about this.
I'm quite unfamiliar with most of the software used by this demo. In particular, I know very little about node.js, derby, and redis. Therefore, I'm following the steps in the README rather blindly. Any help with troubleshooting this error would be appreciated.

Node.js and Sphinx concurrent connection issue on Server

I have been using Sphinx Technology for site and implemented in php and Node.js. Using php and Sphinx, so far i didn't get any issues. But with Node.js and Sphinx, i got the following issues rapidly,
1. Error: Error: Connection is opening in OnConnect
at Socket.<anonymous> (/usr/local/lib/node_modules/limestone/limestone.js:217:26)
at Socket.emit (events.js:64:17)
at Object.afterConnect [as oncomplete] (net.js:614:10)
2. node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: write EPIPE
at errnoException (net.js:640:11)
at Object.afterWrite [as oncomplete] (net.js:478:18)
I have been using limestone node.js module as middleware between Node.js and Sphinx server. My assumption is that above error is occured due to the concurrent connection request to Sphinx. If so, then how to avoid the concurrent sphinx request.
Please suggest on the same.
you can try using sphinxql via one of mysql libraries available for sphinx.

Error starting Juggernaut

When I try to start Juggernaut I get this error :
1 Apr 20:21:01 - socket.io ready - accepting connections
node_redis: no callback to send error: ERR unknown command 'subscribe'
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ERR unknown command 'subscribe'
at RedisReplyParser.<anonymous> (/usr/local/lib/node/.npm/redis/0.5.9/packag
e/index.js:84:27)
at RedisReplyParser.emit (events.js:64:17)
at RedisReplyParser.send_error (/usr/local/lib/node/.npm/redis/0.5.9/package
/lib/parser/javascript.js:251:14)
at RedisReplyParser.execute (/usr/local/lib/node/.npm/redis/0.5.9/package/li
b/parser/javascript.js:110:22)
at RedisClient.on_data (/usr/local/lib/node/.npm/redis/0.5.9/package/index.j
s:328:27)
at Socket.<anonymous> (/usr/local/lib/node/.npm/redis/0.5.9/package/index.js
:99:14)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:672:14)
at IOWatcher.onReadable [as callback] (net.js:177:10)
I didnt find anything to help me!
Try upgrading Redis.
It happened to me, and that's what solved it. I'm using Ubuntu, and the one in the package manager isn't an updated version. It needs to be at least version 2.2.1.
Source: From one of the issues posted on the juggernaut github repo.
EDIT: Upon closer inspection, it looks like you were the one who posted the issue on the github repo. I'll just leave this answer here just in case anyone else has the same problem.

Resources