# Issue in deploying flow after modifying

**URL:** <https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900>\
**Category:** General\
**Created:** [30 August 2023 05:40 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900 "2023-08-30T05:40:31Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [30 August 2023 05:40 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/1 "2023-08-30T05:40:31Z")

</div>

Hi,  
I have created simple custom nodes to send messages in Node RED. I'm facing issue when I modify the flow and deploy it. Changes wont get reflected first time. If I delete the changes and make same changes again, then it works. For example if I have a flow with nodes x, y , z with x -\> y -\> z and if I add a-\>y , this change doesn't get reflected first time. But if I delete node a and again add it second time, then it works. I'm not sure why this is happening.  
I'm using Node-RED v3.0.2 and node.js v16.20.1. I'm building Node RED from source.

Any help on fixing this issue will be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 August 2023 13:50 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/2 "2023-08-30T13:50:35Z")

</div>

> [@chiru](#):
>
> I'm building Node RED from source.

If you try it on a normal install of node red do you see the same problem?

> [@chiru](#):
>
> this change doesn't get reflected first time. But if I delete node a and again add it second time, then it works

What do you mean by 'does not get reflected`? What exact symptom are you seeing?

Also what are these nodes a,x,y,z? Are they all custom nodes that you have created?

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [30 August 2023 14:49 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/3 "2023-08-30T14:49:44Z")

</div>

Thank you for the reply.

> If you try it on a normal install of node red do you see the same problem?

I will try this normal install and check.

> What do you mean by 'does not get reflected`? What exact symptom are you seeing?

When I make new connection a-\>y to the existing working flow x-\>y-\>z and deploy this new flow, the messages from node a are not sent to node y and the logs I have added in node a are not printed. But the flow x-\>y-\>z works fine. If I delete node a and reconnect it again to y second time, then message from node a is sent to node y and logs in node a are printed.

> Also what are these nodes a,x,y,z? Are they all custom nodes that you have created?

yes, a, x, y, z are the custom nodes I have created which has simple functionality to send a message.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 August 2023 15:05 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/4 "2023-08-30T15:05:24Z")

</div>

> [@chiru](#):
>
> When I make new connection a-\>y to the existing working flow x-\>y-\>z and deploy this new flow, the messages from node a are not sent to node y and the logs I have added in node a are not printed.

Is this related to your [previous post](https://discourse.nodered.org/t/sending-message-when-nodes-are-connected/80685/6) in which you are trying to send a message when a new connection is made rather than under more normal circumstances? If so then I suggest continuing this on the original thread as it appears that the technique used to achieve that is not functioning as expected.

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [30 August 2023 15:09 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/5 "2023-08-30T15:09:41Z")

</div>

No, this is a different issue. This is not related to my previous post. I'm trying to send message under normal circumstances here.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 August 2023 15:22 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/6 "2023-08-30T15:22:01Z")

</div>

In that case try it with the standard node-red and let us know the result.

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [30 August 2023 15:45 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/7 "2023-08-30T15:45:06Z")

</div>

sure, I will check and let you know.

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [31 August 2023 10:47 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/8 "2023-08-31T10:47:16Z")

</div>

I am facing the same issue with standard node-red too.

---

<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:** [31 August 2023 10:49 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/9 "2023-08-31T10:49:28Z")

</div>

You will have to provide more detail as your current description is hard to understand.

Remember, we cannot see what you see and you havent linked us to a code repo or shown any code.

Can you provide a gif or series of pictures (with annotations) that clearly describe your issue?

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [31 August 2023 10:57 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/10 "2023-08-31T10:57:50Z")

</div>

I will share the github repo link for the code I have used soon

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 August 2023 12:29 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/11 "2023-08-31T12:29:10Z")

</div>

Under what circumstance does your node send messages? Is it when it receives a message? If it is then add logging into that code to see where it is failing.

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [31 August 2023 15:35 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/12 "2023-08-31T15:35:39Z")

</div>

@Steve-Mcl , @Colin Steps to reproduce the issue  
I have added my test code in this github [repository](https://github.com/chiru091096/node-red-test.git)

Steps to reproduce the issue.

1. Move to .node-red directory  
cd ~/.node-red

2. Install custom-node  
npm install node-red-test/custom-node/

3. Install send-node  
npm install node-red-test/send-node/

4. Run node-red  
node-red

5. Create the below flow  

6. Deploy the flow to see the below output of debug node  
{key : "dummy"}

7. Update the flow as below by making new connections  

8. Deploy the updated flow to see below output  
Expected output -  
{key : "dummy"}  
{key : "dummy"}

9. Delete the extra nodes you added Step 7 and deploy the flow. Add the extra nodes back again as in Step 7 and deploy. Now it produces output as expected.

Please let me know if you are able to reproduce the issue or if you have need any clarifications.  
Note : The issue doesn't occur always but it occurs frequently

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 August 2023 15:45 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/13 "2023-08-31T15:45:30Z")

</div>

You have not responded to my previous post.

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [31 August 2023 15:48 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/14 "2023-08-31T15:48:58Z")

</div>

> Under what circumstance does your node send messages? Is it when it receives a message? If it is then add logging into that code to see where it is failing.

I have created two nodes namely, send-node and custom-node. send-node sends message when it is deployed. custom-node forwards message when it receives input message

---

<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:** [31 August 2023 15:54 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/15 "2023-08-31T15:54:59Z")

</div>

> [@chiru](#):
>
> Note : The issue doesn't occur always but it occurs frequently

probably a race condition because you are [attempting to send before the node is fully created](https://github.com/chiru091096/node-red-test/blob/1183f1d33d4a2e4850431b219a179beabe581fe5/send-node/send-node.js#L7) (i.e. before the current block is finished) and, more importantly, before Node-RED has emitted its update events.

As a test, put the `node.send` call in a setImmediate, nextTick or setTimeout

e.g.

```auto
    msg._info = 'inside node creation, before it is fully registered'
    node.send(msg); 

    setTimeout(() => {
        msg._info = 'setTimeout'
        node.send(msg); 
    }, 1); // 1 ms
    setImmediate(() => {
        msg._info = 'setImmediate'
        node.send(msg);
    });
    process.nextTick(() => {
        msg._info = 'nextTick'
        node.send(msg);
    })

```

and check the `msg` using a debug (set to show full msg object)

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [31 August 2023 15:57 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/16 "2023-08-31T15:57:47Z")

</div>

I will try this to see if it works @Steve-Mcl . Thank you

---

<div class="post-metadata">

**Author:** ![chiru](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chiru](https://discourse.nodered.org/u/chiru)\
**Post date:** [2 September 2023 05:38 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/17 "2023-09-02T05:38:06Z")

</div>

Sending message after node is fully created solves the issue. Thank you @Steve-Mcl for the solution. Thank you @Colin

---

<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:** [16 September 2023 05:38 UTC](https://discourse.nodered.org/t/issue-in-deploying-flow-after-modifying/80900/18 "2023-09-16T05:38:21Z")

</div>

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