diff --git a/src/index.js b/src/index.js index e8a2b9c..7349fde 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,3 @@ -const path = require('path'); const Hapi = require('hapi'); const functionHelper = require('serverless-offline/src/functionHelper'); @@ -41,12 +40,12 @@ class LambdaOffline { this.server = new Hapi.Server(); this.server.connection({ port: this.config.port, host: this.config.host }); - const servicePath = path.join(this.serverless.config.servicePath, this.options.location); + const { servicePath } = this.serverless.config; const serviceRuntime = this.service.provider.runtime; const funOptionsCache = Object.keys(this.service.functions).reduce((acc, key) => { const fun = this.service.getFunction(key); - acc[key] = functionHelper.getFunctionOptions(fun, key, servicePath, serviceRuntime); + acc[fun.name] = functionHelper.getFunctionOptions(fun, key, servicePath, serviceRuntime); return acc; }, {});