# Can't change code in a function node

**URL:** https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058
**Category:** General
**Tags:** home-assistant
**Created:** [12 December 2022 09:01 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058 "2022-12-12T09:01:30Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![dubbfredda](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dubbfredda](https://discourse.nodered.org/u/dubbfredda)
#### Post date: [12 December 2022 09:01 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/1 "2022-12-12T09:01:30Z")

</div>

Hi,  
I have problem with Node-red and function nodes.  
Can’t change/write code in a function node.  
Nothing happens if I try to type anything in the code section.  
Almost as the code is write protected!

Picture from old function node that I want to change.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c06d3efc06fc624fc72b7fabaa069a1435009818.png)

Have tried to reboot the system but it doesn’t change anything.  
And it’s the same if I start with a new function node and try to add code, nothing happens, can’t write any code.  
Anybody else that have had the same problem?

---

<div class="post-metadata">

### Author: ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)
#### Post date: [12 December 2022 10:51 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/2 "2022-12-12T10:51:00Z")

</div>

Hi,  
Try a other browser, flush the browser cache.  
If still not working have a look at this [topic](https://discourse.nodered.org/t/function-node-not-working-after-update/70601), not exactly the same problem but maybe it helps you in the right direction.

---

<div class="post-metadata">

### Author: ![dubbfredda](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dubbfredda](https://discourse.nodered.org/u/dubbfredda)
#### Post date: [12 December 2022 11:38 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/3 "2022-12-12T11:38:43Z")

</div>

I have now tried another browser with the same outcome 😪

---

<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: [12 December 2022 11:45 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/4 "2022-12-12T11:45:11Z")

</div>

1. what vesion of Node-red and node.js? (see the node-red startup log to get this)
2. are you runing Docker or HomeAssistant?
3. what device and OS are you running NR on?

---

<div class="post-metadata">

### Author: ![dubbfredda](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dubbfredda](https://discourse.nodered.org/u/dubbfredda)
#### Post date: [12 December 2022 11:58 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/5 "2022-12-12T11:58:06Z")

</div>

Hi,  
I'm running  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/941c77d464ce09c596f0e330ce94264d19ceca7b.png)

How do I check the node.js version?

I'm running HAOS (2022.11.5) on a Nexcom, NISE 3600E computer

---

<div class="post-metadata">

### Author: ![dubbfredda](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dubbfredda](https://discourse.nodered.org/u/dubbfredda)
#### Post date: [12 December 2022 12:16 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/6 "2022-12-12T12:16:28Z")

</div>

These are the node I have installed in Node-red

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/840c91cda9ef1a85205edf299ef0e54360223377.png)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [12 December 2022 12:26 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/7 "2022-12-12T12:26:25Z")

</div>

So, this is an HA problem not a node-red one. Probably better to ask in the HA forum.

---

<div class="post-metadata">

### Author: ![dubbfredda](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dubbfredda](https://discourse.nodered.org/u/dubbfredda)
#### Post date: [12 December 2022 13:04 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/8 "2022-12-12T13:04:57Z")

</div>

@TotallyInformation I don't understand how can it be a HA problem?  
The only thing I have problem with is the function nodes in Node-red, no problem with HA

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [12 December 2022 13:16 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/9 "2022-12-12T13:16:06Z")

</div>

Your node-red is a HA plugin so they have edited it for HA use.

Have you searched the forum as there are some topics about this

> [@Unable to edit function nodes after update (only with Monaco; ace works fine)](https://discourse.nodered.org/t/unable-to-edit-function-nodes-after-update-only-with-monaco-ace-works-fine/69169/4):
>
> This is an old problem. When monaco was first released, we noticed a hand full of contrib nodes were using an old (bad) version of something called multiple-select.js - where the user could not type. You may have one of these node installed.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [12 December 2022 13:16 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/10 "2022-12-12T13:16:16Z")

</div>

The problem is how HA calls node-red or some security it is applying. ~~We have never seen - to the best of my knowledge - a problem like this when running Node-RED directly.~~ (E1cid clearly has a much better memory than me! 🙂). HA is a complex product - so complex, the recommended deployment approach is to replace your entire operating system with theirs! Node-RED is itself pretty complex but installation and configuration is simple.

---

<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: [12 December 2022 13:57 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/11 "2022-12-12T13:57:27Z")

</div>

As @E1cid states, this is a known problem caused by "bad nodes" you have installed.

See this thread for which nodes cause this issue...

> [@tada Node-RED 2.0 Released](https://discourse.nodered.org/t/node-red-2-0-released/48647/43):
>
> This is a known issue with an prototype polution caused by other nodes. See this thread: [tada Node-RED 2.0.0-beta.1 Released - #84 by Botched1](https://discourse.nodered.org/t/node-red-2-0-0-beta-1-released/46990/84) Do you have any of these nodes installed... [node-red-contrib-deconz-test-zehir](https://www.npmjs.com/package/node-red-contrib-deconz-test-zehir) - [issue raised](https://github.com/deconz-community/node-red-contrib-deconz/issues/140) - fixed in v1.3.3 [node-red-contrib-defaro](https://www.npmjs.com/package/node-red-contrib-defaro) - [issue raised](https://github.com/bkorda/node-red-contrib-defaro/issues/1)[node-red-contrib-zigbee2mqtt](https://www.npmjs.com/package/node-red-contrib-zigbee2mqtt) - [issue raised](https://github.com/andreypopov/node-red-contrib-zigbee2mqtt/issues/41) - fixed in v0.6.9 [node-red-contrib-wirenboard](https://www.npmjs.com/package/node-red-contrib-wirenboard) - [issue raised](https://github.com/andreypopov/node-red-contrib-wirenboard/issues/2) - fixed in v3.5.1 [node-red-contrib-deconz](https://www.npmjs.com/package/node-red-contrib-deconz) - [Issue raised](https://github.com/deconz-community/node-red-contrib-deconz/issues/140) - fixed in v1.3.3 [node-red-con…](https://www.npmjs.com/package/node-red-contrib-zway)

---

<div class="post-metadata">

### Author: ![dubbfredda](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dubbfredda](https://discourse.nodered.org/u/dubbfredda)
#### Post date: [13 December 2022 08:11 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/12 "2022-12-13T08:11:38Z")

</div>

I think I solved the problem. Updated all nodes and the problem with not being able to change/add code in a function nodes seems to be gone. 😀

---

<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: [11 February 2023 08:11 UTC](https://discourse.nodered.org/t/cant-change-code-in-a-function-node/72058/13 "2023-02-11T08:11:45Z")

</div>

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