(Help?) Unable to run ANY Serverless commands

Hi… This is odd and I’m not sure what to do so I’m posting here. All of a sudden I’m unable to run any serverless command. they all hang at the same point when using “SLS_DEBUG=*”. The output looks like this (shortened it a bit):

Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
.
.
.
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio

It always ends with “Serverless: Load command studio”. and hangs with no output. This occurs with package, deploy, offline, etc. I’m pretty stumped here. :confused:

I’m using serverless-webpack with typescript. Here are all of my plugins:

  • serverless-webpack
  • serverless-offline
  • serverless-pseudo-parameters
  • serverless-dynamodb-local

If it helps, here’s my webpack:

const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const slsw = require('serverless-webpack');
const webpack = require('webpack')
const fs = require('fs')

process.env.NODE_ENV = slsw.lib.serverless.service.provider.environment.NODE_ENV
 
module.exports = {
  entry: slsw.lib.entries,
  externals: [
    /aws-sdk/, // Available on AWS Lambda
    nodeExternals()
  ],
    target: 'node',
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          exclude: [
            /node_modules/,
            path.resolve(__dirname, "src/handlers/common/node_modules"),
            path.resolve(__dirname, "src/handlers/handlers/cancelationInitiate/node_modules"),
            path.resolve(__dirname, "src/handlers/handlers/cancelationStatus/node_modules"),
            path.resolve(__dirname, "src/handlers/handlers/cancelationSurvey/node_modules"),
            // path.resolve(__dirname, "src/handlers/handlers/swagger/node_modules"),
            path.resolve(__dirname, "src/handlers/handlers/cancelationInitiate/test"),
            path.resolve(__dirname, "src/handlers/handlers/cancelationSurvey/test"),
            path.resolve(__dirname, "src/handlers/handlers/cancelationStatus/test"),
            path.resolve(__dirname, "src/handlers/common/test")
          ],
          loader: 'ts-loader',
          options: {
            configFile: "tsconfig.production.json"
          }
        }
      ],
    },
    mode: process.env.NODE_ENV === 'local_dev' ? 'development' : 'production',
    resolve: {
      extensions: [ '.ts', '.js', '.json' ],
      alias: {
        'decimal.js': path.resolve(__dirname, 'node_modules/decimal.js/decimal.js')
      }
    },
    plugins: [
      new webpack.EnvironmentPlugin([ 'NODE_ENV', slsw.lib.serverless.service.provider.environment.NODE_ENV]),
    ],
}

Any ideas?

Have you tried uninstalling and reinstalling the serverless package?

npm uninstall -g serverless
npm install -g serverless
1 Like

ha, I really hope that works

No dice. I had already tried doing that in the project folder, but didn’t consider it may be a global issue so I tried that. Ended up killing the node modules and re-installing, and removing my global serverless install all together.

messing around with versions, I actually get an error with anything under serverless 1.7.1 because it doesn’t recognize “!GetAtt”.

1.73-1.83 get me a bit further. setup gets past

Serverless: Load command studio

but hangs at

Serverless: Load command dev

Have you tried a new severless project?

To try recreating the issue? That’s a good idea as well. I’ll give that a go. I’m actually tracing the issue through the serverless package now to see where it hangs, so I’ll keep you posted.

Getting a bunch of these messages:

 
  ##########################################################################################
    # 22591: 12102 of 12106 promises have settled
    # 22591: 4 unsettled promises:
    # 22591:   deep:9069.stage waited on by: undefined
    # 22591:   deep:9074 waited on by: undefined
    # 22591:   deep:9075.region waited on by: undefined
    # 22591:   deep:9076 waited on by: undefined
    # This can result from latent connections but may represent a cyclic variable dependency
    ##########################################

Aaaand there is is. Cyclical reference I missed. I wonder why the logs started showing up all of a sudden that helped me find it? may have been buried by the fact that I was running it in an npm script before.

How did you solve the problema? i am having the same problem

I solved this issue by closing my terminal.

I was having this issue and it turned out that I wasn’t using the latest version of serverless. More specifically, I wasn’t pointed to the latest version installed on my system.

Make sure that your output for sls --version lines up with the latest available version of the framework. Then make sure the location (which sls) lines up with where your npm packages are installed (if you installed using npm install -g serverless).

If not, you can do one of two things:

  1. Check your $PATH. Make sure your global npm bin directory precedes the directory where sls is currently being referenced.
  2. Delete the version of sls being resolved and see if it falls back to the latest version from your global npm directory

Alternatively, you can install serverless locally to your application and run it from the node_modules directory.

Running the serverless commands from a project with a local version installed will now automatically run the version contained in your project and not the global version. If you run serverless --version and it has (local) after the version number it is using the project local version not the global