On redeploy, node.send() not emitting message on custom HTTP trigger node with POST route

What are the steps to reproduce?

  1. Building this custom node-red module : https://github.com/mayahq/maya-red-bot-utils
  2. Install this module
  3. Drag the bot-intent node to pallette and attach to debug node
  4. Get the endpointUrl property of the bot-intent node (logged in console). This is a post node
  5. Send sample data to endpoint curl -d "user=random&pass=random" -X POST http://localhost:1880/<endpointUrl>
  6. Check if the debug node catches and logs msg.payload. It does
  7. Shift the node, or make some small change and redeploy. Repeat Step 5. node.send doesn't emit message

What happens?

On redeploying, node.send() doesn't emit a message when receives a POST request, even though req.body is received and logged. For a while it was working intermittently when I disabled cloning via node.send({}, false). But isn't working now again for some reason when I started with a new userDir. Also doesn't work with custom settings.js

What do you expect to happen?

On redeploying flow, POST request should follow through and node.send() should emit a message just like the standard HTTP In node. HTTP In node is working as expected but this custom node with near identical code is not, on redeploy.

Please tell us about your environment:

  • Node-RED version: 1.1.2
  • Node.js version: v12.16.3
  • npm version: 6.14.4
  • Platform/OS: MacOS/ubuntu
  • Browser: Brave/Chrome

This was originally raised as an issue against Node-RED, which was not appropriate as it's an issue with a contrib node.

I have already pointed at the problem in my comment here: https://github.com/node-red/node-red/issues/2664#issuecomment-666158148