ajmath / serverless-offline-scheduler

MIT License
96 stars 40 forks source link

TypeError when using serverless-offline@6.0.0-alpha #37

Closed cjuega closed 4 years ago

cjuega commented 4 years ago

My Setup

$ serverless --version
Framework Core: 1.60.4
Plugin: 3.2.6
SDK: 2.2.1
Components Core: 1.1.2
Components CLI: 1.4.0
serverless-offline-scheduler@0.3.8
serverless-offline@6.0.0-alpha.56

Issue

A TypeError is raised whenever I try serverless offline start:

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

  TypeError: Cannot read property 'location' of undefined
      at Scheduler.run (/Users/cjuega/Developments/mediasuite/mediastream-exporter/node_modules/serverless-offline-scheduler/lib/scheduler.js:43:45)
      at Object.before:offline:start:init [as hook] (/Users/cjuega/Developments/mediasuite/mediastream-exporter/node_modules/serverless-offline-scheduler/index.js:20:57)
      at BbPromise.reduce (/Users/cjuega/n/lib/node_modules/serverless/lib/classes/PluginManager.js:490:55)
      at tryCatcher (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/reduce.js:168:18)
      at Object.gotAccum (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
      at _drainQueueStep (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:93:12)
      at _drainQueue (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/Users/cjuega/n/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:120:23)

I did try --location option with similar result.

I had a look at the source code. It looks options property is not being returned when calling this.serverless.pluginManager.getPlugins(). Having a look at serverless-offline's source code too, options was renamed to _options in v6.0.0-alpha.2; and completely removed at v6.0.0-alpha.51.

It looks like serverless-offline no longer uses a location option. Shall it be added to serverless-offline-schedule?

cjuega commented 4 years ago

Nevermind, it seems schedule events are now natively supported by serverless-offline@v6.0.0-alpha