PROBLEM with V20.2.3 or V4.1.1 and SFTP NODE

Since updating Node Red in my Home Assistant addon install to v20.2.3, I have an issue with the STPF Node.
Actually I am a bit confused with the versions
Node red is v4.1.1.
And the Addon i believe is V20.2.3

Maybe need to post this somewhere else?

Error
getSftpChannel: Packet length 1399350636 exceeds max length of 262144
Error: getSftpChannel: Packet length 1399350636 exceeds max length of 262144
    at fmtError (/config/node_modules/ssh2-sftp-client/src/utils.js:55:18)
    at /config/node_modules/ssh2-sftp-client/src/index.js:150:18
    at SFTP.onError (/config/node_modules/ssh2/lib/client.js:1587:11)
    at SFTP.emit (node:events:518:28)
    at doFatalSFTPError (/config/node_modules/ssh2/lib/protocol/SFTP.js:2717:8)
    at SFTP.push (/config/node_modules/ssh2/lib/protocol/SFTP.js:220:18)
    at CHANNEL_DATA (/config/node_modules/ssh2/lib/client.js:585:23)
    at 94 (/config/node_modules/ssh2/lib/protocol/handlers.misc.js:930:16)
    at Protocol.onPayload (/config/node_modules/ssh2/lib/protocol/Protocol.js:2059:10)
    at AESGCMDecipherNative.decrypt (/config/node_modules/ssh2/lib/protocol/crypto.js:987:26)

Any Ideas what I can do?

Just to further note:
I have reverted back to the add on v 20.2.2 and that didn't solve the issue
and now back to v20.2.1 and that didn't alter the issue.
So I do not believe that this is to do with the HA addon.

Thanks

To prove that, you should stand up a separate, stand-alone instance of Node-RED and test there.

Many of us in the forum don't use HA at all, just Node-RED. So there aren't so many people who can help. You may need to also try the HA forum.

The HA add-in version and its odd versioning comes, I believe from HA and not from the core Node-RED devs who don't have anything to do with the HA addin.


Have you also updated node.js recently?

Check that you have the latest versions of all nodes (in Manage Palette)

Did you select the option to create a backup when you were prompted to upgrade?

v20.2.3, v20.2.2, v20.2.1. The difference between these 3 releases are changes to the home assistant nodes only. NR itself was updated v19.x - v20.x. You were probably running v19.

Cannot overstate the importance of checking that your palette has all nodes updated - that should be your step one here.

OK so yesterday I established that the hosting server had not made any alterations to their server settings or updates.

I re-installed the updates for the HA addons back to the latest as that obviously wasn't the issue.

I don't really want to go backwards with versions of Node-Red, because long term that is not a viable solution.

Next I updated the FTP/SFTP node in the palette, the effect of that created another issue.
The original node was over 7 years old and I noticed on the description page of the node this was updated 3 years ago, which version I had was impossible to determine. However I now can't authenticate the key, never mind send or receive data.

I tried a couple of other SFTP nodes, at least one of them had no labels against the input boxes and with the help of Chatgpt I managed to complete the entries, but not one of these worked. my conclusion is that there isn't a SFTP node I can use in my setup.

Now I have tried using FTPS, (I think that is what it is called), instead of SFTP and using the node-red-contrib-advanced-ftp, I have managed to get connected and all is working well now.

Hope that might shortcut things for somebody else, if they have a similar issue, always of course that the hosting server supports that method of transfer.

I gave up with ftp nodes and just used an exec node to call the command line client to do whatever I needed.

I need to see how that works.
Do you have any suggestions or URL links to acquaint myself with some info?

Assuming the original node you used is node-red-contrib-sftp (as it's about 7 years old as you mention) - then yes ... it is indeed a bit tired... the underlying library has moved on somewhat (and is still being maintained I think). Looking at the code it does seem the actual api calls have changed slightly so it's not totally simple to update by just refactoring in the latest lib - but it wouldn't be hard.

I've had a quick go and it seems to "work for me"... for gets and puts at least. I haven't published it to the library but you could install it manually in your .node-red directory by "npm i @dceejay/node-red-contrib-sftp" - If someone does try it and it seems to be OK then I will tidy it up and release it properly.

1 Like

I am not sure how to do that. My Node Red instance is installed as an addon in the Home Assistant Pi, which will be in a container I suppose.

I am possibly not the best candidate to try your mod.

Just my two cents worth - I've been using node-red-contrib-sftp for years and it's been OK for me

I'm currently on NR 4.1.1 and node v20.18.1

Installed your node on my main PC and seems to work fine (using put)

![scene](upload://5aBtTbOlUUUl91HiaAto3AD4gqH.jpeg)


[edit] tried get on simplesi.net/last.txt (latest cheerlights colour) and that worked fine as well :slight_smile:

And just to say - things get a mixed messed up with both yours and the original installed at same time so had to remove old one - delete config - then install yours and re-config

Hi - indeed they would get mixed up as mine is just the old one updated and tiny tweak to the api call to fix "get" command. Seeing as you confirm it works "in the wild" I'll carry on to tidy it up a bit more. Thanks

1 Like

One issue is that old one didn't pad out the node text with the config name

So I think it needs a name field so we can shorten the size of the node

image

Indeed - the original had code in there to try to add it - but it wasn't working so i fixed it... but yes - can certainly add a name field. (Should have had one!)

1 Like

Well I have been using it on two Pi instances uploading a few xml files to my website for about a year and on Nov 25th at 16 40 it stopped working. Which is very strange because the only change on that day was updating from 20.2.1 to 20.2.2.

As I do an auto backup to my NAS everyday I can see that is the only change.
I restored only the Node-red 20.2.1, not the whole of HA, as I didn't want to loose some other stuff I had done. However it didn't make any difference, maybe it affected some other thing that is irreversible.

I notice today there is another version 20.2.4 which has just popped up. I might load that on my test pi and see what happens.

The other thing is I think Windows handles SFTP calls in a slightly different way. because I could authenticate using Windows and power shell.

OK so I have just updated to 20.2.4.

Now I am confused.
My original Node in the flow, which has always been working there is no change to the error.
I still get getSftpChannel: Packet length 1399350636 exceeds max length of 262144.

If I drop a new Node into my flow and configure that to EXACTLY the same parameters I get a different error connect: Cannot parse privateKey: Failed to generate information to decrypt key.

This looks like you've published 1.0.2 to npm
https://www.npmjs.com/package/@dceejay/node-red-contrib-sftp

but it's not showing up in my palette

hmm indeed - I can see it on flows and it install manually but...

1 Like

Needed a kick - should be there now.

Looking good
image

and all working once I updated username/password