diff --git a/lib/plugins/aws/package/compile/events/stream/index.js b/lib/plugins/aws/package/compile/events/stream/index.js index a51a1628afec..38db6250821b 100644 --- a/lib/plugins/aws/package/compile/events/stream/index.js +++ b/lib/plugins/aws/package/compile/events/stream/index.js @@ -42,20 +42,24 @@ class AwsCompileStreamEvents { { type: 'object', properties: { - arn: { $ref: '#/definitions/awsArnString' }, + arn: { $ref: '#/definitions/awsArn' }, type: { enum: ['sns', 'sqs'] }, }, additionalProperties: false, required: ['arn'], - }, - { - type: 'object', - properties: { - arn: { $ref: '#/definitions/awsCfFunction' }, - type: { enum: ['sns', 'sqs'] }, - }, - additionalProperties: false, - required: ['arn', 'type'], + oneOf: [ + { + properties: { + arn: { $ref: '#/definitions/awsCfFunction' }, + }, + required: ['type'], + }, + { + properties: { + arn: { $ref: '#/definitions/awsArnString' }, + }, + }, + ], }, ], }, @@ -66,6 +70,19 @@ class AwsCompileStreamEvents { }, additionalProperties: false, required: ['arn'], + oneOf: [ + { + properties: { + arn: { $ref: '#/definitions/awsCfFunction' }, + }, + required: ['type'], + }, + { + properties: { + arn: { $ref: '#/definitions/awsArnString' }, + }, + }, + ], }, ], }); @@ -131,18 +148,6 @@ class AwsCompileStreamEvents { let Enabled = true; if (typeof event.stream === 'object') { - if (typeof event.stream.arn !== 'string') { - // for dynamic arns (GetAtt/ImportValue) - if (!event.stream.type) { - const errorMessage = [ - `Missing "type" property for stream event in function "${functionName}"`, - ' If the "arn" property on a stream is a complex type (such as Fn::GetAtt)', - ' then a "type" must be provided for the stream, either "kinesis" or,', - ' "dynamodb". Please check the docs for more info.', - ].join(''); - throw new this.serverless.classes.Error(errorMessage); - } - } EventSourceArn = event.stream.arn; BatchSize = event.stream.batchSize || BatchSize; if (event.stream.parallelizationFactor) {