Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String output: The "size" argument must be of type number. Received type string #19

Closed
Linbreux opened this issue Apr 19, 2019 · 2 comments

Comments

@Linbreux
Copy link

Hello, when I try to send a string to my PLC I get an error:
The "size" argument must be of type number. Received type string.

I made a textbox with mode "text input" this outputs a string. This string is then passed in the output node. I defined it as a string and gave it size: 80.
image

Then after putting in a string in the textbox, Node-RED crashes.
image

Reading strings works perfect, just like everything else.

@PLCHome
Copy link
Owner

PLCHome commented Apr 27, 2019

Oh sorry:

@dkleber89 changes in the API "new Buffer" in "Buffer.alloc"
old: var data = new Buffer(length)
new: var data = Buffer.alloc(length)

But on row 1623 it must be
old: var stringbuf = new Buffer(val.toString().slice(0,convert.length-1) + '\0', 'binary')
wrong: var stringbuf = Buffer.alloc(val.toString().slice(0,convert.length-1) + '\0', 'binary')
new: var stringbuf = Buffer.from(val.toString().slice(0,convert.length-1) + '\0', 'binary')

@PLCHome
Copy link
Owner

PLCHome commented Apr 27, 2019

solved in version 1.1.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants