node-red-context-redis icon indicating copy to clipboard operation
node-red-context-redis copied to clipboard

get function does not work in context scope

Open romansoft opened this issue 4 years ago • 2 comments

When doing context.get, the returned value is undefined. Verified that context.set writes the value into Redis. global and flow contexts work as expected. I'm guessing something about keys is not matching between set and get in the context scope.

[{"id":"ff717bc4.01b6f8","type":"function","z":"b5b1f0dd.44fdb","name":"test Redis context write","func":"\n\ncontext.set("newPayload", msg.payload, "redis");\n\nreturn msg;\n","outputs":1,"noerr":0,"x":2190,"y":960,"wires":[["9e6ce691.4b1ae8"]]},{"id":"a7c4a692.06ef88","type":"inject","z":"b5b1f0dd.44fdb","name":"","topic":"","payload":"{"val1":123,"val2":234}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1940,"y":960,"wires":[["ff717bc4.01b6f8"]]},{"id":"9e6ce691.4b1ae8","type":"function","z":"b5b1f0dd.44fdb","name":"test Redis context read","func":"\n\ncontext.get("newPayload", "redis", function(err, newPayload) {\n if (err) {\n node.error(err, msg);\n } else {\n node.warn(newPayload);\n }\n});\n","outputs":1,"noerr":0,"x":2180,"y":1040,"wires":[["938f296c.c16e38"]]},{"id":"938f296c.c16e38","type":"debug","z":"b5b1f0dd.44fdb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2390,"y":1040,"wires":[]}]

romansoft avatar Nov 14 '19 09:11 romansoft