|
|
@ -44,6 +44,13 @@ module.exports = { |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
setEnvironmentVars(functionName) { |
|
|
|
const providerEnvVars = this.serverless.service.provider.environment || {}; |
|
|
|
const functionEnvVars = this.serverless.service.functions[functionName].environment || {}; |
|
|
|
|
|
|
|
Object.assign(process.env, providerEnvVars, functionEnvVars); |
|
|
|
}, |
|
|
|
|
|
|
|
run(stats) { |
|
|
|
const functionName = this.options.function; |
|
|
|
|
|
|
@ -52,6 +59,7 @@ module.exports = { |
|
|
|
const handler = this.loadHandler(stats, functionName); |
|
|
|
const event = this.getEvent(); |
|
|
|
const context = this.getContext(functionName); |
|
|
|
this.setEnvironmentVars(functionName); |
|
|
|
|
|
|
|
return new BbPromise((resolve, reject) => handler( |
|
|
|
event, |
|
|
@ -80,6 +88,8 @@ module.exports = { |
|
|
|
const handler = this.loadHandler(stats, functionName, true); |
|
|
|
const event = this.getEvent(); |
|
|
|
const context = this.getContext(functionName); |
|
|
|
this.setEnvironmentVars(functionName); |
|
|
|
|
|
|
|
handler( |
|
|
|
event, |
|
|
|
context, |
|
|
|