From 9bcc6aee1cb852819e7f51e7d5ed7c87c6021868 Mon Sep 17 00:00:00 2001 From: Marcos Lilljedahl Date: Wed, 20 Apr 2016 19:12:18 -0300 Subject: [PATCH] Allow to run functions with env variables correctly populated --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 375f2e8..cd8fa43 100644 --- a/index.js +++ b/index.js @@ -104,8 +104,6 @@ module.exports = function(S) { return functions.forEach(function(fun) { if( -1 !== fun.getRuntime().getName().indexOf('nodejs') ) { - // Override s-function.json defined environment! - Object.getPrototypeOf( fun.getRuntime() ).getEnvVars = ()=> BbPromise.resolve( {} ); _this.handlers[ fun.name ] = fun; fun.endpoints.forEach(function(endpoint){ @@ -174,7 +172,8 @@ module.exports = function(S) { return response || responses['default']; } - fun.run( _this.evt.stage, _this.evt.region, event ).then( (res)=> { + let runtime = fun.getRuntime(); + runtime.run(fun, _this.evt.stage, _this.evt.region, event).then( (res)=> { if( res.status == 'success' ) { resolve(Object.assign({ result: res.response