aws-architect 6.6.38 → 6.6.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/server.js +7 -2
  2. package/package.json +1 -1
package/lib/server.js CHANGED
@@ -144,8 +144,13 @@ function Server(contentDirectory, lambdaApi, logger) {
144
144
 
145
145
  if (req.method !== 'OPTIONS') {
146
146
  try {
147
- let authorizerFunc = lambdaApi.Authorizer.AuthorizerFunc || lambdaApi.authorizer || lambdaApi.Authorizer || (() => ({ principalId: '<no-authorizer-func-specified>' }));
148
- let result = await authorizerFunc(event);
147
+ const authorizationEvent = cloneDeep(event);
148
+ authorizationEvent.type = 'REQUEST';
149
+ authorizationEvent.methodArn = req.method;
150
+ let result = { principalId: '<no-authorizer-func-specified>' };
151
+ if (lambdaApi.Authorizer.AuthorizerFunc || lambdaApi.authorizer || lambdaApi.Authorizer) {
152
+ result = await lambdaApi.handler(authorizationEvent, context);
153
+ }
149
154
  // AWS authorizers do not accept objects
150
155
  if (Object.values(result.context || {}).some(c => typeof c === 'object')) {
151
156
  throw Error('AuthorizerContextPropertieValuesMustBeConvertableToString');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-architect",
3
- "version": "6.6.38",
3
+ "version": "6.6.41",
4
4
  "description": "AWS Architect is a node based tool to configure and deploy AWS-based microservices.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",