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 6 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

Hi - thanks for raising the issue. Please note you are raising an issue against code in a PR that has not been reviewed or tested by the project yet (which is long overdue admittedly), so there may be issues we don't know about yet.

I don't know if @HirokiUchikawa is available to look at this or if he has moved on to other things. If you are in any position to debug this, then adding any comments to the relevant bit of #1 would certainly be helpful.

knolleary avatar Nov 14 '19 10:11 knolleary

Are there any news about this issue? As far as i know the async function works and return values.

Tombcat avatar Dec 22 '20 10:12 Tombcat