Ssh2-ftp-client not working in workflow

Hi there,
I am trying to upload a file to SFTP within a workflow.

I created the following code block (JavaScript)

const Client = import('ssh2-sftp-client');
const sftp = new Client();

const host = 'host';
const port = 22;
const username = 'user';
const password = 'pw';
const remotePath = 'remote.csv';
const dataString = "examplestring";

return new Promise((resolve, reject) => {
    .then(() => {
        return sftp.put(Buffer.from(dataString), remotePath);
    .then(() => {
        return sftp.end();
    .then(() => {
        resolve({ status: 'success', message: 'success' });
    .catch(err => {
        reject("error connecting: " + err.message);

But I get the error:
connect: getConnection: abort(RangeError: WebAssembly.instantiate(): Out of memory: wasm memory)
Any idea what goes wrong?

I'm getting the same error. The same code works fine when I test in a VS Code project, so not sure what's going on here... Did you end up solving this?

Here's the code block I'm trying to use:

  const getFiles = async () => {
    try {
      const sftp = new ssh2SftpClient();

    await sftp.connect({
      host: "**host**",
      port: 22,
      username: "**user**",
      password: "**pw**",
      algorithms: {
        serverHostKey: ["ssh-rsa", "ssh-dss"],

    const data = await sftp.list("/**/path/**");


    return data;
  } catch (err) {

const myFiles = await getFiles();
return myFiles;

Hey @pyee @andreask Taking a look at this with the team and will update here when I can. @pyee You mentioned a public server that you were trying to hit. Mind DMing me that information so we can continue to debug. Thanks!

@joeBumbaca, I just went to and picked the top one for testing. There's a readme.txt file there that works as a good test.

Hi @pyee,

I solved it via Python:

import pysftp

def save_string_to_csv_and_upload(s, filename, sftp_details):
        # Verbindung zum SFTP-Server herstellen und Datei hochladen      
        cnopts = pysftp.CnOpts()
        cnopts.hostkeys = None  

        with pysftp.Connection(cnopts=cnopts, **sftp_details) as sftp:
            with, 'w') as remote_file:
        return "success"
    except Exception as e:
        return f"Fehler beim Hochladen der Datei: {str(e)}"

filename = "file"
sftp_details = {
    "host": "host",
    "username": "user",
    "password": "pw",  

response = save_string_to_csv_and_upload(, filename, sftp_details)

@andreask Thanks for the tip! I believe that @pyee also has this working with Python as well. I've submitted a report to the workflows team regarding the JS library and can update everyone here when there is any movement on the issue.

Any updates?

Weekly I send end-users of the application a report with some table data (.csv file) by using Retool build in e-mail in workflows.
However, some end-users now requested to receive them by using SFTP.

Unfortunately I don't know Phyton :smiling_face_with_tear: and so far I did not manage to set it up in Javascript.

Any updated (code) suggestions on how to set it up in Javascript? Or does this still error?
Thanks :pray:

Hey @ellenhelena no updates on this right now. This error still occurs in with the JS library, but works with the Python library.

Thanks for the update :slight_smile:

1 Like