Join error with message complete

When trying to use the JOIN node by setting msg.complete, I get no output.
here the console output

RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be an integer. Received NaN
    at Function.concat (buffer.js:540:5)
    at completeSend (/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/sequence/17-split.js:459:40)
    at JoinNode._inputCallback (/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/sequence/17-split.js:667:21)
    at JoinNode.Node._emitInput (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:199:18)
    at Immediate._onImmediate (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:33)
    at processImmediate (internal/timers.js:439:21)

Can you show us how you have configured the Join node?

Also stop node red and start it in a terminal and copy/paste the output here. That will show us what versions of tools you are using.


Welcome to Node-RED
===================

14 Mar 18:30:52 - [info] Node-RED version: v1.0.3
14 Mar 18:30:52 - [info] Node.js  version: v12.14.1
14 Mar 18:30:52 - [info] Linux 5.3.0-40-generic x64 LE
14 Mar 18:30:52 - [info] Loading palette nodes
14 Mar 18:30:52 - [info] Dashboard version 2.19.3 started at /ui
14 Mar 18:30:52 - [info] Settings file  : /home/albertoperro/.node-red/settings.js
14 Mar 18:30:52 - [info] Context store  : 'default' [module=memory]
14 Mar 18:30:52 - [info] User directory : /home/albertoperro/.node-red
14 Mar 18:30:52 - [warn] Projects disabled : editorTheme.projects.enabled=false
14 Mar 18:30:52 - [info] Flows file     : /home/albertoperro/.node-red/flows_alberto-XPS.json
14 Mar 18:30:52 - [warn] 

Here the flow exported
flows (1).json (7.2 KB)

Please see this post for how to share a flow in future, it is easier for us if you do it that way. Also you appear to have posted a flow with numerous nodes that are not relevant to the problem.
I can't test your flow as I don't have the right inputs. Can you construct a mini-flow using inject nodes etc to simulate the data you are getting and show the problem with the join node?
Also can you show the rest of the startup log please.

Thank you for your suggestion: here a miniflow:
A buffer is injected every second and it should be concatenated by the join node. I expect that when I inject the complete I should get the big buffer in output. Instead I got no output and the console gives me the error above.

[{"id":"7dd2e40e.784e9c","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"8a845493.05c0e8","type":"inject","z":"7dd2e40e.784e9c","name":"BUFFER","topic":"","payload":"[82,73,127,127,128,127,128,127]","payloadType":"bin","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"x":170,"y":80,"wires":[["b41b1253.2afb9"]]},{"id":"de36ad96.67c3a","type":"inject","z":"7dd2e40e.784e9c","name":"COMPLETE","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":120,"wires":[["e6ff2d13.61945"]]},{"id":"b41b1253.2afb9","type":"join","z":"7dd2e40e.784e9c","name":"","mode":"custom","build":"buffer","property":"payload","propertyType":"msg","key":"topic","joiner":"[]","joinerType":"bin","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":570,"y":80,"wires":[["6327aa51.382ec4"]]},{"id":"e6ff2d13.61945","type":"change","z":"7dd2e40e.784e9c","name":"","rules":[{"t":"set","p":"complete","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":120,"wires":[["b41b1253.2afb9"]]},{"id":"6327aa51.382ec4","type":"debug","z":"7dd2e40e.784e9c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":80,"wires":[]}]

Yes, you are quite right, there does seem to be something wrong.
@dceejay is this a known problem? I can't see why this should not work. The issue seems to be triggered by the Join node being asked to create a buffer. The error appears in the log but not in the debug window, on sending msg.complete. If I change it so that it creates a String then it is ok.

Edit If asked to send the message after a number of parts received it is ok, also ok if the timeout mode is used.

Further edit I have checked that it still fails with node-red 1.0.4 and nodejs 12.16.1

1 Like

Please raise an issue with the above flow and info. Thanks

Done. https://github.com/node-red/node-red/issues/2505

@albydnc it has been pointed out in a response to the bug that when using msg.complete the payload passed is assumed to be part of the sequence to be joined, so you need to include a change node in the msg.complete stream to Delete msg.payload. Then it should be ok.

Ok i did it as you suggested and it worked. I suggest to add this procedure in the documentation, since it wasn't clear.

Thanks for the help!

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