# Problem with context

**URL:** <https://discourse.nodered.org/t/problem-with-context/14500>\
**Category:** General\
**Created:** [19 August 2019 16:10 UTC](https://discourse.nodered.org/t/problem-with-context/14500 "2019-08-19T16:10:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayheavner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jayheavner/32/9804_2.png) [@jayheavner](https://discourse.nodered.org/u/jayheavner)\
**Post date:** [19 August 2019 16:10 UTC](https://discourse.nodered.org/t/problem-with-context/14500/1 "2019-08-19T16:10:04Z")

</div>

I'm running node-red under Docker. I'm trying to use the filesystem for my global context. My node-red volume is mounted to `:/data:Z`

I've set my settings.js as...

```auto
contextStorage: {
      storeInFile: {
          module: "localfilesystem",
           config: {
               dir: "/data/.node-red",
               base: "context",
               cache: false
           }
       },
      default: { module: "memory" }
   },

```

If I issue...

```auto
global.set("test", "Hello world", "storeInFile");

```

... I am unable to `retrieve this value using global.get("test");`

If I bash to my docker instance, I see a folder `/context` under `/data` (not under `/.node-red`). If I browse to /data/context/global and cat global.json I see...

```auto
{
     "test": "Hello world"
}

```

What gives? What am I doing wrong? It acts like it's writing to one path `/data/context/global` but trying to read from another `/data/.node-red/context/global`.

---

<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:** [19 August 2019 16:24 UTC](https://discourse.nodered.org/t/problem-with-context/14500/2 "2019-08-19T16:24:59Z")

</div>

How exactly are you trying to get the value?

Because you have set `cache: false` in your config, the store is in [asynchronous access mode](https://nodered.org/docs/user-guide/writing-functions#asynchronous-context-access).

That means in a function node, you'd have to do:

```auto
global.get("test", "storeInFile", function(val) {
   // do something with `val`
});

```

**Edit** : Also, in your post you are doing the get without the store name - which means it will be going to your default store, not the file store.

---

<div class="post-metadata">

**Author:** ![jayheavner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jayheavner/32/9804_2.png) [@jayheavner](https://discourse.nodered.org/u/jayheavner)\
**Post date:** [19 August 2019 17:21 UTC](https://discourse.nodered.org/t/problem-with-context/14500/3 "2019-08-19T17:21:03Z")

</div>

Thanks, that sorted me out. I didn't see any reference to the overload for global.get() that took the store name. I had tried putting the name in there but it threw a callback error, which now makes sense knowing that cache: false is async.

I completely missing this line in the docs, "If the caching mode is disabled, the store only supports asynchronous access."
