diff --git a/index.js b/index.js index 323abcc..3ee42f0 100644 --- a/index.js +++ b/index.js @@ -62,38 +62,34 @@ class ServerlessLambdaEdgePreExistingCloudFront { } } - this.serverless.configSchemaHandler.defineCustomProperties({ - type: 'object', - properties: { - lambdaEdgePreExistingCloudFront: { - type: 'object', - properties: { - validStages: { - type: 'array', - items: { type: 'string' }, - uniqueItems: true + if (this.serverless.configSchemaHandler) { + this.serverless.configSchemaHandler.defineCustomProperties({ + type: 'object', + properties: { + lambdaEdgePreExistingCloudFront: { + type: 'object', + properties: { + validStages: { + type: 'array', + items: { type: 'string' }, + uniqueItems: true + } } } + } + }) + + this.serverless.configSchemaHandler.defineFunctionEvent('aws', 'preExistingCloudFront', { + type: 'object', + properties: { + distributionId: { type: 'string' }, + eventType: { type: 'string' }, + pathPattern: { type: 'string' }, + includeBody: { type: 'boolean' } }, - } - }) - - this.serverless.configSchemaHandler.defineFunctionEvent('aws', 'preExistingCloudFront', { - type: 'object', - properties: { - distributionId: { type: 'string' }, - eventType: { type: 'string' }, - pathPattern: { type: 'string' }, - includeBody: { type: 'boolean' } - }, - required: [ - 'distributionId', - 'eventType', - 'pathPattern', - 'includeBody' - ] - }) - + required: ['distributionId', 'eventType', 'pathPattern', 'includeBody'] + }) + } } checkAllowedDeployStage() { @@ -162,7 +158,6 @@ class ServerlessLambdaEdgePreExistingCloudFront { }) return arn } - } module.exports = ServerlessLambdaEdgePreExistingCloudFront