sand4rt / ftp-deployer

Simple SFTP / FTP deployment with NodeJS.
https://github.com/marketplace/actions/ftp-deployer
MIT License
47 stars 12 forks source link

DeprecationWarning: Buffer() is deprecated due to security and usability issues #4

Closed Comver closed 1 year ago

Comver commented 3 years ago

Run sand4rt/ftp-deployer@v1.1 (node:3021) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. Deploying... /home/runner/work/_actions/sand4rt/ftp-deployer/v1.1/dist/index.js:11609 return reentry(); ^

ReferenceError: reentry is not defined at /home/runner/work/_actions/sand4rt/ftp-deployer/v1.1/dist/index.js:11609:11 at Socket. (/home/runner/work/_actions/sand4rt/ftp-deployer/v1.1/dist/index.js:11668:7) at Object.onceWrapper (events.js:300:26) at Socket.emit (events.js:210:5) at TCP. (net.js:659:12)

cgsmith commented 3 years ago

@sand4rt How did you create the distribution file?

sand4rt commented 3 years ago

@cgsmith I'm using another package called ftp-deploy that is causing this error: https://github.com/simonh1000/ftp-deploy/issues/116. Let me know if you want to know more.

cgsmith commented 3 years ago

I'm curious how you generated the distribution file? Was this bult separately or downloaded elsewhere? Trying to test a few things locally.

sand4rt commented 3 years ago

You mean the dist folder? This is generated by running npm install and after that run: npm run build.

  1. npm install installs the ncc command
  2. npm run build runs ncc build index.js
  3. In the index.js file, i import a library called ftp-deploy (which has a pagent.exe included)

Noting is downloaded from elsewhere (only from npm through the packages.json)

sand4rt commented 3 years ago

This is how you can test the deployment:

  1. create a test-action.js in the root of the git repository
  2. run npm install && npm run build
  3. Paste the code below in the created test-action.js
  4. Change the host, user, password properties
  5. run node test-action.js
const core = require('@actions/core');
const FtpDeploy = require('ftp-deploy');

core.info('Deploying...');

new FtpDeploy()
    .deploy({
        sftp: true,
        host: 'test.rebex.net',
        port: 22,
        user: 'demo',
        password: 'password',
        remoteRoot: './',
        localRoot: 'dist',
        include:  ['dist'],
        exclude: ['node_modules/**', 'node_modules/**/.*', '.git/**']
    }) 
    .then(response => core.info('Deploy finished:', response))
    .catch(error => core.error(error));
sand4rt commented 1 year ago

Does this still persist after v1.7?