doapp-ryanp / serverless-plugin-browserify

Speed up your node based lambda's
MIT License
33 stars 4 forks source link

Cannot read property 'browserify' of undefined #1

Open dionysio opened 7 years ago

dionysio commented 7 years ago

I have installed your plugin, enabled it in my serverless.yml. I have not used any custom configuration and this happens on deployment:

Serverless: SlsBrowserify::validate
Serverless: SlsBrowserify::globalConfig

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

     Cannot read property 'browserify' of undefined

     For debugging logs, run again after setting SLS_DEBUG env var.

  Stack Trace --------------------------------------------

TypeError: Cannot read property 'browserify' of undefined
    at SlsBrowserify.globalConfig (/usr/local/lib/node_modules/serverless-plugin-browserify/lib/configure.js:15:56)
    at SlsBrowserify.tryCatcher (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:691:18)
    at Async._drainQueue (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

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

     Please report this error. We think it might be a bug.

  Your Environment Information -----------------------------
     OS:                 linux
     Node Version:       4.2.6
     Serverless Version: 1.1.0
thomers commented 7 years ago

I'm having the same problem, using it on the unmodified aws-node-rest-api-with-dynamodb example.

 Node Version:       6.9.1
 Serverless Version: 1.5.0
predescu commented 7 years ago

a workaround is to add into serverless.yml

custom:
  browserify:

probably the solution is to change lib/configure.js on line 15 to check if this.serverless.service.custom is defined or not