serverless / serverless-azure-functions

Serverless Azure Functions Plugin – Add Azure Functions support to the Serverless Framework
MIT License
266 stars 162 forks source link

Specifying `verbose` flag fails deployment #470

Closed paprins closed 4 years ago

paprins commented 4 years ago

Specifying verbose flag fails deployment

When passing the verbose flag while deploying, the deployment fails with an error message saying logLevelStr.toLowerCase is not a function.

FYI: if I don't specify the verbose flag, deployment is ok.

What I did

I created a new sls project using the following command:

Using serverless version 1.71.3

sls create -t azure-python --name azure-demo --path azure-demo

Next, I updated serverless-azure-functions to latest version (~ 2.0.4)

Here's my package.json:

{
  "name": "azure-demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "serverless-azure-functions": "^2.0.4"
  }
}

Running sls deploy works just fine, but using the verbose flag fails with the following stacktrace:

PS: I tried with and without a value for verbose (~ source code says it should default to info)

➜ sls deploy --verbose

  Type Error ---------------------------------------------

  TypeError: logLevelStr.toLowerCase is not a function
      at new LoggingService (/Users/pprins/projects/innogy/azure/azure-demo/node_modules/serverless-azure-functions/lib/services/loggingService.js:30:24)
      at AzurePackagePlugin.AzureBasePlugin (/Users/pprins/projects/innogy/azure/azure-demo/node_modules/serverless-azure-functions/lib/plugins/azureBasePlugin.js:12:31)
      at new AzurePackagePlugin (/Users/pprins/projects/innogy/azure/azure-demo/node_modules/serverless-azure-functions/lib/plugins/package/azurePackagePlugin.js:59:28)
      at PluginManager.addPlugin (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:78:28)
      at new AzureIndex (/Users/pprins/projects/innogy/azure/azure-demo/node_modules/serverless-azure-functions/lib/index.js:29:39)
      at PluginManager.addPlugin (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:78:28)
      at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:115:31
      at Array.forEach (<anonymous>)
      at PluginManager.loadAllPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:115:8)
      at /usr/local/lib/node_modules/serverless/lib/Serverless.js:96:35
      at tryCatcher (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
      at Promise._fulfill (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:673:18)
      at Promise._resolveCallback (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:466:57)
      at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:559:17)
      at Promise._settlePromise (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
      at Promise._fulfill (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:673:18)
      at PromiseArray._resolve (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise_array.js:127:19)
      at PromiseArray._promiseFulfilled (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise_array.js:145:14)
      at Promise._settlePromise (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:609:26)
      at Promise._settlePromise0 (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
      at Promise._fulfill (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:673:18)
      at Promise._resolveCallback (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:466:57)
      at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:559:17)
      at Promise._settlePromise (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
      at Promise._fulfill (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:673:18)
      at PropertiesPromiseArray.PromiseArray._resolve (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise_array.js:127:19)
      at PropertiesPromiseArray._promiseFulfilled (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/props.js:78:14)
      at Promise._settlePromise (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:609:26)
      at Promise._settlePromise0 (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
      at _drainQueueStep (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:93:12)
      at _drainQueue (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:439:21)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.14.1
     Framework Version:         1.71.3
     Plugin Version:            3.6.12
     SDK Version:               2.3.0
     Components Version:        2.30.11
tbarlow12 commented 4 years ago

@paprins thanks for the issue. The above PR should fix it 👍