Skip to content

get function does not work in context scope #3

Open
@romansoft

Description

@romansoft

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":[]}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions