@@ -92,7 +92,7 @@ module.exports = {
9292 . then ( ( result ) => {
9393 const region = this . options . region || 'us-east-1' ;
9494 this . stateMachineArn =
95- `arn:aws:states:${ region } :${ result . Account } :stateMachine:${ this . options . statemachine } ` ;
95+ `arn:aws:states:${ region } :${ result . Account } :stateMachine:${ this . options . state } ` ;
9696 return BbPromise . resolve ( ) ;
9797 } ) ;
9898 } ,
@@ -123,22 +123,22 @@ module.exports = {
123123 return BbPromise . resolve ( ) ;
124124 }
125125
126- if ( typeof this . stepFunctions [ this . options . statemachine ] === 'undefined' ) {
126+ if ( typeof this . stepFunctions [ this . options . state ] === 'undefined' ) {
127127 const errorMessage = [
128- `Step function "${ this . options . statemachine } " is not exists` ,
128+ `Step function "${ this . options . state } " is not exists` ,
129129 ] . join ( '' ) ;
130130 throw new this . serverless . classes . Error ( errorMessage ) ;
131131 }
132132
133- _ . forEach ( this . stepFunctions [ this . options . statemachine ] . States , ( value , key ) => {
133+ _ . forEach ( this . stepFunctions [ this . options . state ] . States , ( value , key ) => {
134134 if ( value . Resource && ! value . Resource . match ( / a r n : a w s : l a m b d a / ) ) {
135- this . stepFunctions [ this . options . statemachine ] . States [ key ] . Resource
135+ this . stepFunctions [ this . options . state ] . States [ key ] . Resource
136136 = this . functionArns [ value . Resource ] ;
137137 }
138138 } ) ;
139139
140- this . awsStateLanguage [ this . options . statemachine ] =
141- JSON . stringify ( this . stepFunctions [ this . options . statemachine ] ) ;
140+ this . awsStateLanguage [ this . options . state ] =
141+ JSON . stringify ( this . stepFunctions [ this . options . state ] ) ;
142142 return BbPromise . resolve ( ) ;
143143 } ,
144144
@@ -157,16 +157,19 @@ module.exports = {
157157 return this . provider . request ( 'StepFunctions' ,
158158 'createStateMachine' ,
159159 {
160- definition : this . awsStateLanguage [ this . options . statemachine ] ,
161- name : this . options . statemachine ,
160+ definition : this . awsStateLanguage [ this . options . state ] ,
161+ name : this . options . state ,
162162 roleArn : this . iamRoleArn ,
163163 } ,
164164 this . options . stage ,
165165 this . options . region )
166166 . then ( ( ) => BbPromise . resolve ( ) )
167167 . catch ( ( error ) => {
168+ console . log ( error )
168169 if ( error . message . match ( / S t a t e M a c h i n e i s b e i n g d e l e t e d / ) ) {
169170 setTimeout ( this . createStateMachine . bind ( this ) , 5000 ) ;
171+ } else {
172+ throw new this . serverless . classes . Error ( error . message ) ;
170173 }
171174 } ) ;
172175 } ,
0 commit comments