Error: Tarn: opt.max must be an integer

Hi
I get a strange error when using the MSSQL-Node (node-red-contrib-mssql-plus v.0.4.0) with nodeRed (v1.0.3).
When executing a query, it shows: 'Tarn: opt.max must be an integer > 0'.

The node worked without problems over the last months. Now, after changing SQL Server settings, the error comes up. Unfortunately going back to the old server doesn't solve the problem neither.

Has anyone got an idea what the error msg is about or how to solve it?

Google didn't help that much...

Kind regards

What is the query being run?
Also is that the complete error message, nothing else?

It's a simple insert:

INSERT INTO mqtt_datablockManagementLog (machine,payload)VALUES ('400023','ONLINE');

But the error shows up on all queries, regardless of their type.

I've now also checked the log output of NodeRed:

27 Mar 14:47:07 - [info] [MSSQL-CN:DataWarehouse] Error connecting to server : 172.23.4.55\GalileoAPS, database : DataWarehouse, port : 1433, user : sa
27 Mar 14:47:07 - [info] [MSSQL:BereinigeLog] Error: Tarn: opt.max must be an integer > 0

Don't know where the problem is. When inserting wrong data (Password, Server...) it tells me exactly where the error is.

Technicly ( i belive 400023 is opt.max) is a a string , not an integer , could you export your flow and share it with us ?

As @lizzardguki said, your value '400023' is a string
the error says opt.max must be an integer > 0
I would give it a try sending 400023 instead of '400023'

1 Like

Thank you so much for your support.

I've reduced the flow to a SSCCE (see below).
Note that the query is not the one from my previous post, but the error msg remains the same.

[{"id":"4547bc84.5880d4","type":"tab","label":"Forum","disabled":false,"info":""},{"id":"6b0f29f2.9044d8","type":"inject","z":"4547bc84.5880d4","name":"Jede Stunde","topic":"","payload":"","payloadType":"date","repeat":"3600","crontab":"","once":true,"onceDelay":"0.5","x":140,"y":60,"wires":[["145f7910.9b8617"]]},{"id":"145f7910.9b8617","type":"function","z":"4547bc84.5880d4","name":"QryDeleteData","func":"var out = \"DELETE FROM [mqtt_datablockManagementLog] \"\nout = out + \" WHERE DATEDIFF(DAY, zeitstempel, getDate()) > 7;\"\nmsg.payload=out;\n\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":60,"wires":[["b4771efb.8dcc4"]]},{"id":"b4771efb.8dcc4","type":"MSSQL","z":"4547bc84.5880d4","mssqlCN":"9deeb56.dd4c3c8","name":"BereinigeLog","query":"","outField":"payload","returnType":"0","throwErrors":"0","x":650,"y":60,"wires":[["866efd5e.07b1d8"]]},{"id":"866efd5e.07b1d8","type":"debug","z":"4547bc84.5880d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":60,"wires":[]},{"id":"9deeb56.dd4c3c8","type":"MSSQL-CN","z":"","tdsVersion":"7_3_A","name":"DataWarehouse","server":"172.23.4.55\\GalileoAPS","port":"1433","encyption":false,"database":"DataWarehouse","useUTC":false,"connectTimeout":"","requestTimeout":"","cancelTimeout":"","pool":"","parseJSON":false}]

What is the query you are sending now?

my suggestion is to:
add a function before the mssql node
and use parseInt(opt.max)

Will be offline while fixing my old car,will catch up after isolation time starts :smiley: :confused:

The query is:

DELETE FROM [mqtt_datablockManagementLog] 
WHERE DATEDIFF(DAY, zeitstempel, getDate()) > 7;

This time without the probability of strange conversion errors :slight_smile:

Sorry, I don't get it. opt.max is not a variable I am using. I don't know where it comes from :thinking:

Can you explain? Especially in the context of the second query where there is nothing that could be converted...

I think the link below gives some clues, it is to do with database__pool__max being passed as a string instead of an integer.
I think you had better raise an issue against the node.
What version of nodejs are you using (node -v will tell you)?

Oddly I have been completely unable to find what Tarn is.

I did, but no reply there. So I tried it here in the Node Red forum :slight_smile:

Node v12.14.0

OK, now it gets silly.
I've just modified the js file of the node and hardcoded the pool size to max = 5 regardless of the node config. Restarted the service and everything worked.

Changed the js back to default. Restarted the service and still working.

Btw. No opt or tarn in js of the node. Must be in underlying functions of node red or node js...

I'll update my post in the node-forum. Maybe they can give some further explanation.

Thank you very much for your support.

Yep, definitely silly.
I think tarn is in the underlying mssql module.

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