# Context not working for name

**URL:** <https://discourse.nodered.org/t/context-not-working-for-name/31155>\
**Category:** General\
**Created:** [5 August 2020 01:13 UTC](https://discourse.nodered.org/t/context-not-working-for-name/31155 "2020-08-05T01:13:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 August 2020 01:13 UTC](https://discourse.nodered.org/t/context-not-working-for-name/31155/1 "2020-08-05T01:13:55Z")

</div>

It caught me for a while then I remembered the _device name_ is set in the `settings.js` file.

So, when I look at my `context on a new machine I see this:

![Screenshot from 2020-08-05 11-08-31](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/6/f66e557e09d34a585d24b8fcca42456c5f64c554.png)

I'm confused.

This is what the `settings.js` file looks like:

 ![Screenshot from 2020-08-05 11-08-15](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/b/abbfa144178c2f529be982607e28d5f14307e9a1.png)

Why isn't `myDeviceName` seen in the context?

NR 1.1.2

Stopping and starting Node-Red I see this:

```auto
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
5 Aug 11:18:14 - [info]
Welcome to Node-RED
===================
5 Aug 11:18:14 - [info] Node-RED version: v1.1.2
5 Aug 11:18:14 - [info] Node.js version: v10.22.0
5 Aug 11:18:14 - [info] Linux 4.19.118+ arm LE
5 Aug 11:18:24 - [info] Loading palette nodes
5 Aug 11:18:56 - [info] Dashboard version 2.23.0 started at /ui
5 Aug 11:18:59 - [info] Settings file : /home/pi/.node-red/settings.js
5 Aug 11:18:59 - [info] HTTP Static : /home/pi/.node-red/public
5 Aug 11:18:59 - [info] Context store : 'default' [module=memory]
5 Aug 11:18:59 - [info] User directory : /home/pi/.node-red
5 Aug 11:18:59 - [warn] Projects disabled : editorTheme.projects.enabled=false
5 Aug 11:18:59 - [info] Flows file : /home/pi/.node-red/flows_LCDPi.json
5 Aug 11:19:01 - [info] Server now running at http://127.0.0.1:1880/
5 Aug 11:19:01 - [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.
---------------------------------------------------------------------
5 Aug 11:19:02 - [info] Starting flows
5 Aug 11:19:06 - [info] Started flows
5 Aug 11:19:06 - [info] [mqtt-broker:MQTT host] Connected to broker: mqtt://192.168.0.99:1883
5 Aug 11:19:08 - [warn] [function:Variable repeat time] Value set
5 Aug 11:19:10 - [error] [gate:7fcdf90.f234588] Invalid command

```

The last line is work in progress. But nothing to indicate it is not happy with the name.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [5 August 2020 05:29 UTC](https://discourse.nodered.org/t/context-not-working-for-name/31155/2 "2020-08-05T05:29:49Z")

</div>

EDIT: Sorry, forget, I think my example is not relevant to yours

All visible here for me. Doesn't help but just to verify they should

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/f/3f51d65e6a50409e43b1173ba3cfb480fb7809e3.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8a4936ad8172781b8685d08992febd4ada782e85.png)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [5 August 2020 06:21 UTC](https://discourse.nodered.org/t/context-not-working-for-name/31155/3 "2020-08-05T06:21:29Z")

</div>

> [@Trying\_to\_learn](#):
>
> Why isn't `myDeviceName` seen in the context?

Read the section underneath the part you marked with the red triangle.

> // `global.keys()` returns a list of all properties set in global context.  
> // This allows them to be displayed in the Context Sidebar within the editor.  
> // In some circumstances it is not desirable to expose them to the editor. The  
> // following property can be used to hide any property set in `functionGlobalContext`  
> // from being list by `global.keys()`.  
> // By default, the property is set to false to avoid accidental exposure of  
> // their values. Setting this to true will cause the keys to be listed.  
> exportGlobalContextKeys: false,

Change exportGlobalContextKeys to true.

See also the [discussion here](https://discourse.nodered.org/t/feedback-wanted-hiding-functionglobalcontext-from-context-sidebar/8106)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 August 2020 06:46 UTC](https://discourse.nodered.org/t/context-not-working-for-name/31155/4 "2020-08-05T06:46:50Z")

</div>

I'm guessing this was introduced in a recent update.

Yeah, _RTFM_.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 August 2020 06:47 UTC](https://discourse.nodered.org/t/context-not-working-for-name/31155/5 "2020-08-19T06:47:02Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
