Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

deploy:fetch throwing error : TypeError: Cannot read property 'run' of undefined #283

@VishalTaj

Description

@VishalTaj

Hi,

I am getting TypeError: Cannot read property 'run' of undefined error when i'm trying to deploy. please help me get a fix it. deployment was working fine suddenly i started getting this error.

cmd used: npx shipit staging deploy

Running 'deploy:init' task...
Finished 'deploy:init' after 453 μs
Running 'deploy:fetch' task...
Setup workspace...
/app/node_modules/shipit-cli/lib/Shipit.js:209
      return _this.pool.run(command, options);
                        ^

TypeError: Cannot read property 'run' of undefined
    at /app/node_modules/shipit-cli/lib/Shipit.js:209:25
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/app/node_modules/shipit-cli/lib/Shipit.js:18:103)
    at _next (/app/node_modules/shipit-cli/lib/Shipit.js:20:194)
    at /app/node_modules/shipit-cli/lib/Shipit.js:20:364
    at new Promise (<anonymous>)
    at /app/node_modules/shipit-cli/lib/Shipit.js:20:97
    at Shipit.remote (/app/node_modules/shipit-cli/lib/Shipit.js:210:7)
    at Shipit.<anonymous> (/app/shipitfile.js:34:14)
    at Shipit.emit (node:events:381:22)
    at Shipit.initialize (/app/node_modules/shipit-cli/lib/Shipit.js:100:10)
    at /app/node_modules/shipit-cli/lib/cli.js:89:14
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/app/node_modules/shipit-cli/lib/cli.js:19:103)
    at _next (/app/node_modules/shipit-cli/lib/cli.js:21:194)

below is my configuration:

shipitfile.js

module.exports = shipit => {
    require('shipit-deploy')(shipit);
    require('shipit-shared')(shipit);
    shipit.initConfig({
      default: {
        deployTo: '/var/www/example.com',
        keepReleases: 5,
        shared: {
          overwrite: true,
          dirs: ['node_modules'],
          files: ['.env']
        }
      },
      staging: {
        servers: '[email protected]',
        branch: 'staging'
      },
    });
    
        // Callbacks

    shipit.on('init', () => {
      shipit.remote(`set NODE_ENV=${shipit.environment}`);
    })
    shipit.on('updated', () => {
      shipit.start('npm-install');
    });
  
    shipit.on('published', () => {

      shipit.start('db:migrate');
      shipit.start('pm2-server');
    });

    // Tasks
    shipit.blTask('npm-install', async () => {
      shipit.remote(`cd ${shipit.releasePath} && npm install --${shipit.environment}`);
    });

    shipit.blTask('pm2-server', async () => {
      await shipit.remote(`pm2 delete -s ${appName} || :`);
      await shipit.remote(
        `pm2 start ${shipit.releasePath}/app.js --env ${shipit.environment} --watch true --name ${appName}`
      );
    });

    shipit.blTask('db:migrate', async () => {
      shipit.remote(`cd ${shipit.releasePath} && npx sequelize db:migrate --env ${shipit.environment}`);
    });

 }   

Please help me to sort this out thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions