Skip to content

Commit

Permalink
Custom Authorization function is initialized with the environmental v…
Browse files Browse the repository at this point in the history
…ariables of endpoint function issue fix

Fix for Issue #97
  • Loading branch information
AshanFernando committed Sep 6, 2016
1 parent c6ceff5 commit 41883e5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/createAuthScheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ module.exports = function createAuthScheme(authFun, funName, endpointPath, optio
methodArn: `arn:aws:execute-api:${options.region}:<Account id>:<API id>/${options.stage}/${funName}/${endpointPath}`,
};

// Set environment variables
const newEnvVars = toPlainOrEmptyObject(populatedAuthFun.environment);
resetEnvVariables(this.envVars, newEnvVars);
this.envVars = newEnvVars;

// Create the Authorization function handler
let handler;

Expand Down Expand Up @@ -103,9 +108,6 @@ module.exports = function createAuthScheme(authFun, funName, endpointPath, optio
}
});

// Set environment variables
resetEnvVariables({}, toPlainOrEmptyObject(populatedAuthFun.environment));

// Execute the Authorization Function
handler(event, lambdaContext, lambdaContext.done);
},
Expand Down

0 comments on commit 41883e5

Please sign in to comment.