File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ const compileKinesisServiceProxy = require('./package/kinesis/compileKinesisServ
1919// SQS
2020const compileMethodsToSqs = require ( './package/sqs/compileMethodsToSqs' )
2121const compileIamRoleToSqs = require ( './package/sqs/compileIamRoleToSqs' )
22- // const validateKinesisServiceProxy = require('./package/sqs/validateKinesisServiceProxy ')
22+ const validateSqsServiceProxy = require ( './package/sqs/validateSqsServiceProxy ' )
2323const compileSqsServiceProxy = require ( './package/sqs/compileSqsServiceProxy' )
2424
2525class ServerlessApigatewayServiceProxy {
@@ -44,6 +44,7 @@ class ServerlessApigatewayServiceProxy {
4444 compileMethodsToSqs ,
4545 compileIamRoleToSqs ,
4646 compileSqsServiceProxy ,
47+ validateSqsServiceProxy ,
4748 getStackInfo ,
4849 validate ,
4950 methods ,
Original file line number Diff line number Diff line change 11'use strict'
22module . exports = {
33 async compileSqsServiceProxy ( ) {
4- // await this.validateKinesisServiceProxy ()
4+ await this . validateSqsServiceProxy ( )
55 await this . compileIamRoleToSqs ( )
66 await this . compileMethodsToSqs ( )
77 }
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const BbPromise = require ( 'bluebird' )
4+ const _ = require ( 'lodash' )
5+
6+ module . exports = {
7+ async validateSqsServiceProxy ( ) {
8+ await BbPromise . all (
9+ this . validated . events . map ( async ( serviceProxy ) => {
10+ if ( serviceProxy . functionName == 'sqs' ) {
11+ if ( ! _ . has ( serviceProxy . http , 'queueName' ) ) {
12+ return BbPromise . reject (
13+ new this . serverless . classes . Error ( 'Missing "queueName" property in SQS Service Proxy' )
14+ )
15+ }
16+
17+ if (
18+ typeof serviceProxy . http . queueName != 'object' &&
19+ typeof serviceProxy . http . queueName != 'string'
20+ ) {
21+ const errorMessage = [
22+ 'You can only set "string" or the AWS "Fn::GetAtt" intrinsic function' ,
23+ ' like { Fn::GetAtt: [ "SQSQueueResourceId", "QueueName" ] }}' ,
24+ ' as a queueName property'
25+ ] . join ( '' )
26+ return BbPromise . reject ( new this . serverless . classes . Error ( errorMessage ) )
27+ }
28+
29+ if (
30+ typeof serviceProxy . http . queueName == 'object' &&
31+ ! _ . has ( serviceProxy . http . queueName , 'Fn::GetAtt' )
32+ ) {
33+ const errorMessage = [
34+ 'You can only set "string" or the AWS "Fn::GetAtt" intrinsic function' ,
35+ ' like { Fn::GetAtt: [ "SQSQueueResourceId", "QueueName" ] }}' ,
36+ ' as a queueName property'
37+ ] . join ( '' )
38+ return BbPromise . reject ( new this . serverless . classes . Error ( errorMessage ) )
39+ }
40+ }
41+ } )
42+ )
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments