grunt-sftp-deploy doesn't read authKey credentials
16:07 25 Jun 2026

grunt-sftp-deploy used to work reliably. Now I'm getting a warning that aborts the procedure:

Warning: Cannot read properties of undefined (reading 'authKey').

I have experience using grunt, so I'm pretty confident that my syntax is correct.

Here's my Gruntfile code:

'sftp-deploy': {
            img: [ {
                auth: connectkey,
                cache: false,
                src: '../images/AA-toUpload/',
                dest: idmserverpath + 'images/',
                exclusions: [ '*.svg', '**/.DS_Store' ],
                progress: false
            } ]
}

I have similar blocks for css and jpg which show their own src, dest, and exclusions. For those as well as the img usage, the upload is the last of a number of grunt tasks. Images get minimized, converted to several sizes and to .webp. CSS files get minimized and concatenated, and those tasks work fine. It's the upload that aborts.

I added square brackets around the { } block because I was getting a fatal error. Adding the square brackets fixed it.

Fatal error: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined

"connectkey" and "idmserverpath" are variables.

connectkey - { host: 'ftp.address.com', port: 2233, authKey: 'foolsgold9' };

idmserverpath = "home/mywebsitefolder/public_html/"; // path to the server

The server path works manually with Cyberduck.

The authKey is in a json file called .ftppass, saved in the same directory as the Gruntfile.

{
 "foolsgold9": {
    "username": "user",
    "password": "xx-random-saved-chars-xx"
  }
}

Again, these credentials work in Cyberduck. Anyway, according to the warning I get, this file is not being read.

I am using an 'improved' version of the plugin called grunt-sftp-deploy-i. I get the same error with the unimproved version, grunt-sftp-deploy.

The NPM page for the plugin says this:

If keyLocation is not specified, grunt-sftp-deploy looks for keys at ~/.ssh/id_dsa

I had no file called id_dsa in my ~/.ssh folder, so I created one, populating it with the same json code as in the .ftppass file. This didn't help. I should say that adding to the .ssh folder is new ground for me and above my pay grade, so if you have any suggestions about this, please bring them on. I'm not sure the json code is appropriate for that file.

Incidentally, I do get some vulnerabilities reported when I install grunt plugins. In this case I've used grunt audit fix and grunt audit fix --force, but for some of them no fix is available. I hope this isn't the problem.

There are a number of queries about this on StackOverflow, mostly from maybe 10 years ago. Many users apparently left out the .ftppass file. But I have it, and it isn't being read.

Any help will be appreciated.

gruntjs sftp