# RED.nodes.eachConfig is undefined

**URL:** https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621
**Category:** Developing Nodes
**Created:** [21 March 2024 06:36 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621 "2024-03-21T06:36:09Z")
**Posts on this page:** 7
**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: [21 March 2024 06:36 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621/1 "2024-03-21T06:36:09Z")

</div>

Hi folks,

I have used `RED.nodes.eachConfig` already several times, but always in code for sidebars. Now I need to call it from inside the code of a node. Because I need to get the dashboard D2 url, similar to how it is done in the sidebar _'open dashboard'_ button [code](https://github.com/FlowFuse/node-red-dashboard/blob/main/nodes/config/ui_base.html#L324).

But `RED.nodes.eachConfig` it is _ **undefined** _. I first thought that it is perhaps undefined when my node is being created, so I moved to my onInput handler an lazy load as soon as the first message is being injected:

```auto
onInput: function (msg, send, done) {.
    if(!node.dashboardPath) {
        RED.nodes.eachConfig(function (n) {
            if(n.type === 'ui-base') {
                let base = RED.settings.httpNodeRoot || '/'
                let basePart = base.endsWith('/') ? base : `${base}/`
                let dashPart = n.path.startsWith('/') ? n.path.slice(1) : n.path
                node.dashboardPath = `${basePart}${dashPart}`
                return
            }
        })
    }
}

```

However while debugging I see `eachConfig` is still absent in the list:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/65197479e9967a022a6616b9313962a0eb9512e0.png)

Not sure if this function is not provided to the nodes for security concerns or another reason? Or if there is perhaps a better way to implement this?

Thanks!!  
Bart

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [21 March 2024 06:50 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621/2 "2024-03-21T06:50:17Z")

</div>

Hi Bart. What is the use case - why do you need the dashboard URL? If this is something other dashboard nodes would want to use, it would make sense for dashboard to expose a helper property or function for easy access.

---

<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: [21 March 2024 07:04 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621/3 "2024-03-21T07:04:40Z")

</div>

Morning Steve,

I am finalizing the migration of my old web-push ui node for D2. I will give a typical use case to explain why I need to have the dashboard url in the server side of my node:

1. Suppose I detect a human on one of my ip cams.
2. The video footage of that ip cam is accessible via page2 of my dashboard.
3. I inject a message into my web-push ui node, containing the relative path page2
4. My node determines the full url for page2 and sends it to the Google (or Microsoft, Apple, ...) push service.
5. The notification arrives on my Android phone.
6. I click on the notification
7. Android will pass it to my browser app (i.e. Chrome)
8. The browser will call the corresponding service worker js file, i.e. my javascript code that runs in the background.
9. My service worker js file will call the full url of the dashboard page2.
10. The Node-RED dashboard will open on page2.

This all happens within a second. So I can navigate very quickly to the dashboard page related to the problem that has triggered the notification.

But that means I need the dashboard url in the server side of my node. And I want to avoid that people need to enter it manually in my config screen. Because when they change it, they will probably forget to change it in my config screen.

Thanks for reading and have a nice day at work 😉

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [21 March 2024 08:25 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621/4 "2024-03-21T08:25:37Z")

</div>

@BartButenaers there may still be a need to enter a base URL (e.g. for when the user of your node is behind a proxy or other kind of gateway) but I understand the use case.

@joepavitt

Would it be reasonable to consider adding a hook to the ui-base so that ui contrib nodes can be notified with system info like like this? Alternatively, a callable function in ui-base, ui-page, ui-group whereby the contrib node can request this type of info from its parent?

Seems like it would be useful for tighter integration with DB2 and would remove the need for contrib nodes to jump through ~loops~ hoops to get this?

---

<div class="post-metadata">

### Author: ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)
#### Post date: [21 March 2024 08:40 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621/5 "2024-03-21T08:40:15Z")

</div>

> [@Steve-Mcl](#):
>
> Alternatively, a callable function in ui-base, ui-page, ui-group whereby the contrib node can request this type of info from its parent?

Open to this for sure - makes sense imo.

I thought I had it already, but in fact, I actually compute it client-side and add it to the `setup` VueX store. @BartButenaers if you can open an issue detailing what you'd need - then we'll get it in.

---

<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: [21 March 2024 11:16 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621/6 "2024-03-21T11:16:04Z")

</div>

> [@joepavitt](#):
>
> @BartButenaers if you can open an issue detailing what you'd need - then we'll get it in

Thanks guys!!  
I have registered an [issue](https://github.com/FlowFuse/node-red-dashboard/issues/693) with the details.

---

<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: [20 May 2024 11:16 UTC](https://discourse.nodered.org/t/red-nodes-eachconfig-is-undefined/86621/7 "2024-05-20T11:16:35Z")

</div>

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