# Config node has no properties on the server-side

**URL:** <https://discourse.nodered.org/t/config-node-has-no-properties-on-the-server-side/68404>\
**Category:** Developing Nodes\
**Created:** [29 September 2022 22:02 UTC](https://discourse.nodered.org/t/config-node-has-no-properties-on-the-server-side/68404 "2022-09-29T22:02:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [29 September 2022 22:02 UTC](https://discourse.nodered.org/t/config-node-has-no-properties-on-the-server-side/68404/1 "2022-09-29T22:02:54Z")

</div>

Hi folks,

Have been implemented quite a number of config nodes in the past withouth problems, but now it fails. Must be something stupid, but I don't see what I am doing wrong. So it would be nice if somebody with a fresh pair of eyes can have a look at it.

1. The html file of the config node is quite simple:

```auto
<script type="text/html" data-template-name="tensorflowObjDetConfig">
   <div class="form-row">
       <label for="node-config-input-someProperty"><i class="fa fa-file-image-o"></i> Some proper</label>
       <input type="text" id="node-config-input-someProperty">
   </div>
</script>

<script type="text/javascript">
   RED.nodes.registerType('tensorflowObjDetConfig',{
     category: 'config',
     color: '#ff758d',
     defaults: {
         someProperty: {value:""}
     },   
</script>

```

2. And this is the js file of the config node:

```auto
 module.exports = function(RED) {
   var settings = RED.settings;
   function TensorFlowObjDetConfig(config) {
   }

   RED.nodes.registerType("tensorflowObjDetConfig",TensorFlowObjDetConfig);
}

```

3. This config node is being used in the html file of my custom node:

```auto
<script type="text/html" data-template-name="tensorflowObjDet">
   <div class="form-row">
     <label for="node-input-tensorflowConfig"><i class="fa fa-cog"></i> Model</label>
     <input type="text" id="node-input-tensorflowConfig">
   </div>
</script>

<script type="text/javascript">
    RED.nodes.registerType('tensorflowObjDet', {
        ...
        defaults: {
           tensorflowConfig: {value:"", type: "tensorflowObjDetConfig"}
        },
        ...
     }
 });
</script>

```

At first sight this seemed to be working fine. The input of that config node screen is _ **persisted** _ on the server (after Deploy). Because when I open an extra flow editor client browser session, the same data appears in the config node screen in the second client.

And the `tensorflowConfig` contains (on the server side) the id of the selected config node. So far so good.

But when I try to get (on the server side) the config node corresponding to that id:

```auto
if (node.tensorflowConfig) {
   var tensorflowConfigNode = RED.nodes.getNode(node.tensorflowConfig);
}

```

Then I get an _ **empty config node instance** _, i.e. all the properties that I have entered in the config node screen are empty ;-(

You can see this also on the server side in the list of active nodes:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/5/95d5f0240d6c61b03d86f4178b29097addd58940.png)

Not sure if this exception in the startup log is related to this:

```auto
TypeError: Cannot read properties of undefined (reading 'padEnd')
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:254:62)
    at Object.start [as startFlows] (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:394:33)

```

Thanks!!!  
Bart

---

<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:** [29 September 2022 22:07 UTC](https://discourse.nodered.org/t/config-node-has-no-properties-on-the-server-side/68404/2 "2022-09-29T22:07:51Z")

</div>

Hi @BartButenaers

You are missing the call to `RED.nodes.createNode(this,config)` inside the `TensorFlowObjDetConfig` function.

Even with that, the node in the runtime doesn't automatically get the config properties assigned to it - it's up to you to pull out whatever values from `config` you want to store on the node object directly and do so.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 September 2022 05:57 UTC](https://discourse.nodered.org/t/config-node-has-no-properties-on-the-server-side/68404/3 "2022-09-30T05:57:50Z")

</div>

> [@knolleary](#):
>
> You are missing the call to `RED.nodes.createNode(this,config)`

Hi @knolleary,  
How could I have missed that...  
Thanks for reviewing my code snippets!!!!!!!

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 September 2022 07:07 UTC](https://discourse.nodered.org/t/config-node-has-no-properties-on-the-server-side/68404/4 "2022-09-30T07:07:19Z")

</div>

For anybody else making ever the same stupid mistake as me, I will write down here the code for Nick' solution...

When you change the js file of the config node to this:

```auto
 module.exports = function(RED) {
    var settings = RED.settings;

    function TensorFlowObjDetConfig(config) {
        RED.nodes.createNode(this,config);
        this.someProperty = config.someProperty;
    }

    RED.nodes.registerType("tensorflowObjDetConfig",TensorFlowObjDetConfig);
}

```

Then you will see the someProperty appearing in the node config instance:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/8/481b3f351e8a4923e49a289ad7fc9b13dee26de9.png)

---

<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:** [14 October 2022 07:07 UTC](https://discourse.nodered.org/t/config-node-has-no-properties-on-the-server-side/68404/5 "2022-10-14T07:07:54Z")

</div>

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