diff --git a/plugin/index.js b/plugin/index.js index a1882f3..29e0ff5 100644 --- a/plugin/index.js +++ b/plugin/index.js @@ -245,6 +245,12 @@ class ServerlessSecrets { if (!functions[functionName].environment) functions[functionName].environment = {} Object.assign(functions[functionName].environment, this.config.environments.$global, this.config.environments[functionName]) }) + + // process.env.IS_LOCAL === 'true' is set when called by 'sls invoke local' + if (process.env._HANDLER === undefined && process.env.IS_LOCAL === 'true') { + const invokedFunction = functions[this.options.function] + process.env._HANDLER = invokedFunction.handler + } } setIamPermissions () {