# TypeError: ctx.keys is not a function at exportContextStore

**URL:** <https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942>\
**Category:** General\
**Created:** [7 September 2018 11:13 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942 "2018-09-07T11:13:01Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![nithinbandaru1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nithinbandaru1/32/2513_2.png) [@nithinbandaru1](https://discourse.nodered.org/u/nithinbandaru1)\
**Post date:** [7 September 2018 11:13 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/1 "2018-09-07T11:13:01Z")

</div>

Hi,

I reinstalled node-red in my system by removing all node-modules in user folder. I updated to latest version.

I am running node-red on pm2.

After successful instillation I am getting this error:

> TypeError: ctx.keys is not a function  
> at exportContextStore (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\admin\context.js:23:9)  
> at C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\admin\context.js:106:21  
> at Array.forEach ()  
> at get (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\admin\context.js:105:24)  
> at Layer.handle [as handle\_request] (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\express\lib\router\layer.js:95:5)  
> at next (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\express\lib\router\route.js:137:13)  
> at C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\auth\index.js:57:28  
> at complete (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\passport\lib\middleware\authenticate.js:263:13)  
> at C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\passport\lib\middleware\authenticate.js:270:15  
> at pass (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\passport\lib\authenticator.js:431:14)

**What is the reason for this error? How to resolve this error?**

With regards,  
Nithin B.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 September 2018 12:29 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/2 "2018-09-07T12:29:29Z")

</div>

Hi @nithinbandaru1 - that's unexpected. I can't immediately explain why you'd hit that.

Have you enabled the persistent context feature in 0.19? If so, how have you got it configured?

What version of node.js are you using?

---

<div class="post-metadata">

**Author:** ![nithinbandaru1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nithinbandaru1/32/2513_2.png) [@nithinbandaru1](https://discourse.nodered.org/u/nithinbandaru1)\
**Post date:** [7 September 2018 12:43 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/3 "2018-09-07T12:43:42Z")

</div>

Hi @knolleary Thanks for replying.

Have you enabled the persistent context feature in 0.19?  
I have no idea what this is. So I think I didn't enable it.

**Node.js version I am using:** v8.11.4

**More Info:**

The error is thrown on flow tab click only(have multiple flows).

Only changes I made in settings file are:

1. Changed flow path.
2. Enabled admin privileges.
3. Enabled projects.
4. Check the results I get when I start node-red form cmd.

> 7 Sep 18:08:40 - [info]
> 
> # Welcome to Node-RED
> 
> 7 Sep 18:08:40 - [info] Node-RED version: v0.19.3  
> 7 Sep 18:08:40 - [info] Node.js version: v8.11.4  
> 7 Sep 18:08:40 - [info] Windows\_NT 10.0.17134 x64 LE  
> 7 Sep 18:08:41 - [info] Loading palette nodes  
> 7 Sep 18:08:42 - [warn] rpi-gpio : Raspberry Pi specific node set inactive  
> 7 Sep 18:08:42 - [info] Dashboard version 2.9.8 started at /ui  
> 7 Sep 18:08:42 - [warn] ------------------------------------------------------  
> 7 Sep 18:08:42 - [warn] [node-red/tail] Not currently supported on Windows.  
> 7 Sep 18:08:42 - [warn] ------------------------------------------------------  
> 7 Sep 18:08:42 - [info] Settings file : \Users\Nithin B.node-red\settings.js  
> 7 Sep 18:08:42 - [info] Context store : 'default' [module=memory]  
> 7 Sep 18:08:42 - [info] User directory : \Users\Nithin B.node-red  
> 7 Sep 18:08:42 - [warn] Projects disabled : editorTheme.projects.enabled=false  
> 7 Sep 18:08:42 - [info] Flows file : F:\1.Office\4.JSL\1.Projects\StreamAnalyticsNodeRed\SMS\EAF V1.json  
> 7 Sep 18:08:42 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
> 7 Sep 18:08:42 - [warn]
> 
> * * *
> 
> Your flow credentials file is encrypted using a system-generated key.
> 
> If the system-generated key is lost for any reason, your credentials  
> file will not be recoverable, you will have to delete it and re-enter  
> your credentials.
> 
> ## You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.
> 
> 7 Sep 18:08:42 - [info] Starting flows  
> 7 Sep 18:08:43 - [info] Started flows  
> 7 Sep 18:08:43 - [info] [mqtt-broker:SMS\_EAF1(127.0.0.1)] Connected to broker: mqtt://127.0.0.1:1883  
> 7 Sep 18:08:43 - [info] [mqtt-broker:SMS\_EAF2(127.0.0.1)] Connected to broker: mqtt://127.0.0.1:1883  
> 7 Sep 18:08:43 - [info] [mqtt-broker:SMS\_AOD(127.0.0.1)] Connected to broker: mqtt://127.0.0.1:1883  
> 7 Sep 18:08:43 - [info] [mqtt-broker:CRM\_HAPL(127.0.0.1)] Connected to broker: mqtt://127.0.0.1:1883  
> 7 Sep 18:08:43 - [info] [mqtt-broker:CRM\_CAPL(127.0.0.1)] Connected to broker: mqtt://127.0.0.1:1883  
> TypeError: ctx.keys is not a function  
> at exportContextStore (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\admin\context.js:23:9)  
> at C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\admin\context.js:106:21  
> at Array.forEach ()  
> at get (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\admin\context.js:105:24)  
> at Layer.handle [as handle\_request] (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\express\lib\router\layer.js:95:5)  
> at next (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\express\lib\router\route.js:137:13)  
> at C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\red\api\auth\index.js:63:13  
> at Layer.handle [as handle\_request] (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\express\lib\router\layer.js:95:5)  
> at next (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\express\lib\router\route.js:137:13)  
> at Route.dispatch (C:\Users\Nithin B\AppData\Roaming\npm\node\_modules\node-red\node\_modules\express\lib\router\route.js:112:3)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 September 2018 12:48 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/4 "2018-09-07T12:48:19Z")

</div>

Thanks for sharing that.

In your browser's javascript console there should be a corresponding error - can you share the url being requested that hits the error?

Nick

---

<div class="post-metadata">

**Author:** ![nithinbandaru1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nithinbandaru1/32/2513_2.png) [@nithinbandaru1](https://discourse.nodered.org/u/nithinbandaru1)\
**Post date:** [7 September 2018 12:55 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/5 "2018-09-07T12:55:38Z")

</div>

**URL requested:**

[http://127.0.0.1:1880/context/flow/86d0a059.c7f39](http://127.0.0.1:1880/context/flow/86d0a059.c7f39)

**JS file:**

vendor.js:5

**Stack track:**

> GET [http://127.0.0.1:1880/context/flow/86d0a059.c7f39](http://127.0.0.1:1880/context/flow/86d0a059.c7f39) 400 (Bad Request)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> m.(anonymous function) @ vendor.js:5  
> getJSON @ vendor.js:5  
> f @ red.min.js:16  
> u @ red.min.js:16  
> (anonymous) @ red.min.js:16  
> emit @ red.min.js:16  
> onchange @ red.min.js:16  
> y @ red.min.js:16  
> show @ red.min.js:16  
> success @ main.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> a @ main.min.js:16  
> success @ main.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> t @ main.min.js:16  
> success @ main.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> r @ main.min.js:16  
> (anonymous) @ main.min.js:16  
> success @ red.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> (anonymous) @ red.min.js:16  
> loadNodeCatalogs @ red.min.js:16  
> success @ main.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> e @ main.min.js:16  
> success @ red.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> t @ red.min.js:16  
> success @ red.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> a @ red.min.js:16  
> init @ red.min.js:16  
> (anonymous) @ main.min.js:16  
> (anonymous) @ red.min.js:16  
> (anonymous) @ vendor.js:39  
> (anonymous) @ vendor.js:39  
> g @ vendor.js:39  
> success @ vendor.js:39  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> x @ vendor.js:5  
> b @ vendor.js:5  
> XMLHttpRequest.send (async)  
> send @ vendor.js:5  
> ajax @ vendor.js:5  
> \_fetchOne @ vendor.js:39  
> (anonymous) @ vendor.js:39  
> each @ vendor.js:2  
> (anonymous) @ vendor.js:39  
> each @ vendor.js:2  
> \_fetch @ vendor.js:39  
> load @ vendor.js:39  
> g @ vendor.js:39  
> init @ red.min.js:16  
> (anonymous) @ main.min.js:16  
> j @ vendor.js:2  
> fireWith @ vendor.js:2  
> ready @ vendor.js:2  
> J @ vendor.js:2

---

<div class="post-metadata">

**Author:** ![nithinbandaru1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nithinbandaru1/32/2513_2.png) [@nithinbandaru1](https://discourse.nodered.org/u/nithinbandaru1)\
**Post date:** [7 September 2018 13:17 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/6 "2018-09-07T13:17:24Z")

</div>

**Image of console:**

The below error is occurring on tab click of a flow.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5013d406719050108aabecfa08175e1501e2b405.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 September 2018 13:33 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/7 "2018-09-07T13:33:14Z")

</div>

Thanks for the info. I don't have a quick answer for you. If you haven't enable persistent context, then I can't explain why you should be hitting these errors and no one else is.

This shouldn't stop you using the editor and your flows should still be running.

---

<div class="post-metadata">

**Author:** ![nithinbandaru1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nithinbandaru1/32/2513_2.png) [@nithinbandaru1](https://discourse.nodered.org/u/nithinbandaru1)\
**Post date:** [10 September 2018 06:37 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/8 "2018-09-10T06:37:52Z")

</div>

@knolleary More info on this:

I think I found the issue.

I realized that one of my flows is not throwing the exception and tried to figure out the differences.

**Flow1(with error):**

```
[{"id":"ce98dcdb.871cf","type":"tab","label":"HAP","disabled":false,"info":""},{"id":"2fecfbfd.9180d4","type":"inject","z":"ce98dcdb.871cf","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"0.1","x":105,"y":80,"wires":[["1a7ef9ac.e8ddc6"]]},{"id":"1a7ef9ac.e8ddc6","type":"function","z":"ce98dcdb.871cf","name":"OnFlowsLoad","func":"// Delete all flow variables except global referenced variable.\nfor (var variableName in context.flow) {\n if (variableName !== \"global\")\n {\n delete context.flow[variableName];\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":335,"y":80,"wires":[[]]}]

```

**Flow 2(without error):**

```
[{"id":"6daaea62.30e304","type":"tab","label":"HS","disabled":false,"info":""},{"id":"44313aa0.f97a54","type":"inject","z":"6daaea62.30e304","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"0.1","x":115,"y":50,"wires":[["57192856.fcbd88"]]},{"id":"57192856.fcbd88","type":"function","z":"6daaea62.30e304","name":"OnFlowsLoad","func":"// Delete all flow variables except global referenced variable.\nfor (var variableName in context.flow) {\n if (variableName !== \"global\")\n {\n //delete context.flow[variableName];\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":345,"y":50,"wires":[[]]}]

```

**Difference is:**

In **flow 1** I am **deleting all variables in context.flow** object using **delete keyword**. I am initializing all required objects on deploy which I will be using later for processing data. **Before initializing I am deleting first all variables in context.flow** object and then **creating variables, common functions, objects** etc in context.flow.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a4d432fbe9947e1744e5b3601e881afaf8e98006.png)

**NOTE:** I didn't see this errors in previous versions of node-red.

@knolleary Can you see any changes made in node-red that led to this error now?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 September 2018 09:47 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/9 "2018-09-10T09:47:00Z")

</div>

@knolleary - This may be related

There seems to be a problem in NR v0.19.2 (node.js v8.9.4 on OSX) with 'flow' variables (see attached flow with examples). NOTE: if I use globals, there is no problem.

If I try to set them via a change or function node, I get the error

```auto
TypeError: target.set is not a function
    at Promise (/usr/local/lib/node_modules/node-red/nodes/core/logic/15-change.js:247:44)
    at new Promise (<anonymous>)
    at getFromValue.then.fromParts (/usr/local/lib/node_modules/node-red/nodes/core/logic/15-change.js:235:36)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

```

While a 'get' of the flow variable results in this error:

```auto
TypeError: node.context(...)[type].get is not a function
    at Object.evaluateNodeProperty (/usr/local/lib/node_modules/node-red/red/runtime/util.js:371:39)
    at Promise (/usr/local/lib/node_modules/node-red/nodes/core/logic/15-change.js:113:30)
    at new Promise (<anonymous>)
    at getToValue (/usr/local/lib/node_modules/node-red/nodes/core/logic/15-change.js:112:24)
    at applyRule (/usr/local/lib/node_modules/node-red/nodes/core/logic/15-change.js:199:24)
    at applyRules (/usr/local/lib/node_modules/node-red/nodes/core/logic/15-change.js:307:31)
    at ChangeNode.<anonymous> (/usr/local/lib/node_modules/node-red/nodes/core/logic/15-change.js:323:17)
    at emitOne (events.js:116:13)
    at ChangeNode.emit (events.js:211:7)
    at ChangeNode.Node.receive (/usr/local/lib/node_modules/node-red/red/runtime/nodes/Node.js:215:14)
    at InjectNode.Node.send (/usr/local/lib/node_modules/node-red/red/runtime/nodes/Node.js:137:22)
    at InjectNode.<anonymous> (/usr/local/lib/node_modules/node-red/nodes/core/core/20-inject.js:78:26)
    at emitOne (events.js:116:13)
    at InjectNode.emit (events.js:211:7)
    at InjectNode.Node.receive (/usr/local/lib/node_modules/node-red/red/runtime/nodes/Node.js:215:14)
    at /usr/local/lib/node_modules/node-red/nodes/core/core/20-inject.js:117:22

```

Here is a set of flows demonstrating this issue:

```auto
[{"id":"132aca24.42755e","type":"catch","z":"37535c9b.381484","name":"catch get flow wakeup","scope":["ad967390.1dac28"],"x":400,"y":580,"wires":[["bbeed82f.d918f8"]]},{"id":"bbeed82f.d918f8","type":"debug","z":"37535c9b.381484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":580,"wires":[]},{"id":"56d40061.b106b","type":"inject","z":"37535c9b.381484","name":"","topic":"","payload":"good morning","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":200,"wires":[["3a7dd5fe.1a5f1a"]]},{"id":"3a7dd5fe.1a5f1a","type":"change","z":"37535c9b.381484","name":"","rules":[{"t":"set","p":"wakeup","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":200,"wires":[["d60e90a1.7dffd"]]},{"id":"3c224f09.02eb3","type":"inject","z":"37535c9b.381484","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":540,"wires":[["ad967390.1dac28"]]},{"id":"ad967390.1dac28","type":"change","z":"37535c9b.381484","name":"get flow wakeup","rules":[{"t":"set","p":"payload","pt":"msg","to":"wakeup","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":540,"wires":[["f4cfefb2.9cff1"]]},{"id":"f4cfefb2.9cff1","type":"debug","z":"37535c9b.381484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":540,"wires":[]},{"id":"d60e90a1.7dffd","type":"debug","z":"37535c9b.381484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":200,"wires":[]},{"id":"91df793b.c9f58","type":"inject","z":"37535c9b.381484","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":320,"wires":[["9e2a73ee.79f27"]]},{"id":"9e2a73ee.79f27","type":"function","z":"37535c9b.381484","name":"flow set wakeup","func":"flow.set(\"wakeup\", \"good morning\");\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":320,"wires":[["abac1ca9.4d782"]]},{"id":"abac1ca9.4d782","type":"debug","z":"37535c9b.381484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":320,"wires":[]},{"id":"3244736b.b884c4","type":"catch","z":"37535c9b.381484","name":"catch set flow wakup","scope":["9e2a73ee.79f27"],"x":420,"y":360,"wires":[["a8c4a686.040878"]]},{"id":"a8c4a686.040878","type":"debug","z":"37535c9b.381484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":360,"wires":[]},{"id":"22eabd2d.0b5c0a","type":"catch","z":"37535c9b.381484","name":"catch change flow wakup","scope":["3a7dd5fe.1a5f1a"],"x":430,"y":240,"wires":[["366d40e.bd561c"]]},{"id":"366d40e.bd561c","type":"debug","z":"37535c9b.381484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":240,"wires":[]},{"id":"97a13312.c7d91","type":"comment","z":"37535c9b.381484","name":"Setting a 'flow' variable causes an error, but globals work","info":"","x":430,"y":140,"wires":[]},{"id":"9bbc5e37.45ca38","type":"comment","z":"37535c9b.381484","name":"Getting the flow fails too, but again globals work","info":"","x":380,"y":480,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 September 2018 09:53 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/10 "2018-09-10T09:53:12Z")

</div>

@knolleary  
And as soon as I posted, I noticed that NR v0.19.3 is ou, so I installed it and the issue is fixed there....however, there are lots of debug messages coming in the log...

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [10 September 2018 09:55 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/11 "2018-09-10T09:55:18Z")

</div>

> [@zenofmud](#):
>
> however, there are lots of debug messages coming in the log.

I added some extra debug messages around the loading of node modules if that's what you mean.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 September 2018 09:55 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/12 "2018-09-10T09:55:57Z")

</div>

Just realized I had turned debug on in settings.js

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 September 2018 09:58 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/13 "2018-09-10T09:58:42Z")

</div>

@nithinbandaru1 - I suggest you upgrade to NR v0.19.3 and see if the issue still exists for you. I tried your flow that had the error and I get no error which I did see in v0.19.2

---

<div class="post-metadata">

**Author:** ![nithinbandaru1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nithinbandaru1/32/2513_2.png) [@nithinbandaru1](https://discourse.nodered.org/u/nithinbandaru1)\
**Post date:** [10 September 2018 13:42 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/14 "2018-09-10T13:42:05Z")

</div>

@zenofmud I just checked node-red version I am using Its already v0.19.3.

**Where you suggesting to upgrade form GitHub?**

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/249de7845adc0afedad2df17d1314a040f22c9a3.png)

Here is the complete error I am getting:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e6f8cf37961a0abbeef030ff76e6a52e66cd5d97.png)

Moreover I see this error only on tab click of a flow.

**I also see this in pallet window. Is this normal? I think I didn't see this in previous versions.**

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/64a2b68603ac6995d8bd9f8b6f98961ea3b61d92.png)

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [10 September 2018 14:07 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/15 "2018-09-10T14:07:06Z")

</div>

The dashboard errors are due to the fact you have 2 different "dashboards" installed that are incompatible with each other.  
Please delete `node-red-contrib-ui_j` and restart Node-RED

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 September 2018 17:38 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/16 "2018-09-10T17:38:48Z")

</div>

@knolleary - I've been able to reproduce the error the OP gets with the attached flow. I wonder if this is both a bug and the user accessing the contect object incorrectly which triggers the error.

First the bug: With the attached flow, Under the comment 'Vannila version' press the inject node and in the debug you will see the timestamp. Next swap to 'Flow 2' - nothing happens (even monitoring the log) now swap back to 'Flow 1' and I receive the error the OP posted.

Second the incorrect access of the contect object. My theory is that the way the function tries to access the 'contect' object is incorrect. (It may have been correct before the persistent option was added - as a side note the node 'node-red-contrib-contextbrowser' now throws an error and I will open an issue about that in GitHub).

If you restart NR and run the flow under the comment '`Debug version' you will see the OP's code returns 'get', 'set' and 'keys' which are not the names of flow variables set by the user.

So two questions:

1. how do you now list all the flow variables set  
and
2. is the situation the user has a bug or caused by the change in accessing the names of flow variables?

The exttra flows are for adding and displaying a flow variable and dumping the contect object. And a demo  
showing flow variables do not work in function nodes using the flow.get/set format. (change nodes don't work eithor.)

Flow to reproduce this follows:

```auto
[{"id":"510516ec.7bad18","type":"inject","z":"c20906ef.52b988","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"0.1","x":180,"y":100,"wires":[["3a568dd.06a2172"]]},{"id":"3a568dd.06a2172","type":"function","z":"c20906ef.52b988","name":"OnFlowsLoad","func":"// Delete all flow variables except global referenced variable.\nfor (var variableName in context.flow) {\n if (variableName !== \"global\")\n {\n delete context.flow[variableName];\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":100,"wires":[["2d0a461f.fd3232"]]},{"id":"205c6d34.40afe2","type":"catch","z":"c20906ef.52b988","name":"","scope":null,"x":620,"y":560,"wires":[["c9c65c0b.e2dea8"]]},{"id":"c9c65c0b.e2dea8","type":"debug","z":"c20906ef.52b988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":810,"y":560,"wires":[]},{"id":"2d0a461f.fd3232","type":"debug","z":"c20906ef.52b988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":100,"wires":[]},{"id":"2af14454.477944","type":"inject","z":"c20906ef.52b988","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"0.1","x":180,"y":340,"wires":[["c38e2a00.f1428"]]},{"id":"c38e2a00.f1428","type":"function","z":"c20906ef.52b988","name":"Dump context object","func":"msg.payload = context;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":340,"wires":[["3f3c3bc.252db44"]]},{"id":"3f3c3bc.252db44","type":"debug","z":"c20906ef.52b988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":630,"y":340,"wires":[]},{"id":"9a3c422.1f73ec","type":"inject","z":"c20906ef.52b988","name":"","topic":"","payload":"Happy trails","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":460,"wires":[["ab0068ce.b309c"]]},{"id":"ae468489.40884","type":"inject","z":"c20906ef.52b988","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":500,"wires":[["3472f453.04841c"]]},{"id":"54f2571a.f84188","type":"debug","z":"c20906ef.52b988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":650,"y":500,"wires":[]},{"id":"71887d9.00be704","type":"comment","z":"c20906ef.52b988","name":"Vannila version","info":"","x":180,"y":60,"wires":[]},{"id":"1e301b7e.92fdf5","type":"inject","z":"c20906ef.52b988","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"0.1","x":180,"y":220,"wires":[["3801e321.50859c"]]},{"id":"3801e321.50859c","type":"function","z":"c20906ef.52b988","name":"OnFlowsLoad","func":"// Delete all flow variables except global referenced variable.\nfor (var variableName in context.flow) {\n node.warn(\"debug1:\"+ variableName);\n if (variableName !== \"global\")\n {\n delete context.flow[variableName];\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":220,"wires":[["2b73f2a5.7fa04e"]]},{"id":"2b73f2a5.7fa04e","type":"debug","z":"c20906ef.52b988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":220,"wires":[]},{"id":"801a7e3c.caa7d8","type":"comment","z":"c20906ef.52b988","name":"Debug version","info":"","x":180,"y":180,"wires":[]},{"id":"d20dd1fd.3bf108","type":"comment","z":"c20906ef.52b988","name":"Debug version","info":"","x":180,"y":300,"wires":[]},{"id":"c26c178d.f2fc88","type":"comment","z":"c20906ef.52b988","name":"Debug version","info":"","x":180,"y":420,"wires":[]},{"id":"a7a51c21.ef657","type":"debug","z":"c20906ef.52b988","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":650,"y":460,"wires":[]},{"id":"4f582c9e.89915c","type":"change","z":"c20906ef.52b988","name":"dump the flow variable","rules":[{"t":"move","p":"test","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":560,"wires":[[]]},{"id":"ab0068ce.b309c","type":"function","z":"c20906ef.52b988","name":"Create flow variable","func":"flow.set(\"myData\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":460,"wires":[["a7a51c21.ef657"]]},{"id":"3472f453.04841c","type":"function","z":"c20906ef.52b988","name":"Create flow variable","func":"var x = flow.get(\"myData\");\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":500,"wires":[["54f2571a.f84188"]]}]

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [10 September 2018 19:10 UTC](https://discourse.nodered.org/t/typeerror-ctx-keys-is-not-a-function-at-exportcontextstore/2942/17 "2018-09-10T19:10:35Z")

</div>

Hi @nithinbandaru1

The problem here is you are deleting all properties on the `context.global` object - which includes the `get`, `set` and `keys` functions.

Before 0.19, that probably didn't matter if you weren't using them. But in 0.19 we introduced the context sidebar panel which uses `context.keys` to list the properties in storage - so when the editor loads it tries to load the context contents in the sidebar (likewise when you switch tabs) and you hit this error.

I'll look to see if we can make the get/set/keys functions non-enumerable properties so they can't be deleted by mistake.
