@@ -135,25 +135,29 @@ class ServerlessStepFunctions {
135
135
const endpointInfo = this . endpointInfo ;
136
136
message += `${ chalk . yellow . underline ( 'Serverless StepFunctions OutPuts' ) } \n` ;
137
137
message += `${ chalk . yellow ( 'endpoints:' ) } ` ;
138
- _ . forEach ( this . getAllStateMachines ( ) , ( stateMachineName ) => {
139
- const stateMachineObj = this . getStateMachine ( stateMachineName ) ;
140
- stateMachineObj . events . forEach ( event => {
141
- if ( event . http ) {
142
- let method ;
143
- let path ;
138
+ if ( this . isStateMachines ( ) ) {
139
+ _ . forEach ( this . getAllStateMachines ( ) , ( stateMachineName ) => {
140
+ const stateMachineObj = this . getStateMachine ( stateMachineName ) ;
141
+ if ( stateMachineObj . events != null && _ . isArray ( stateMachineObj . events ) ) {
142
+ stateMachineObj . events . forEach ( event => {
143
+ if ( event . http ) {
144
+ let method ;
145
+ let path ;
144
146
145
- if ( typeof event . http === 'object' ) {
146
- method = event . http . method . toUpperCase ( ) ;
147
- path = event . http . path ;
148
- } else {
149
- method = event . http . split ( ' ' ) [ 0 ] . toUpperCase ( ) ;
150
- path = event . http . split ( ' ' ) [ 1 ] ;
151
- }
152
- path = path !== '/' ? `/${ path . split ( '/' ) . filter ( p => p !== '' ) . join ( '/' ) } ` : '' ;
153
- message += `\n ${ method } - ${ endpointInfo } ${ path } ` ;
147
+ if ( typeof event . http === 'object' ) {
148
+ method = event . http . method . toUpperCase ( ) ;
149
+ path = event . http . path ;
150
+ } else {
151
+ method = event . http . split ( ' ' ) [ 0 ] . toUpperCase ( ) ;
152
+ path = event . http . split ( ' ' ) [ 1 ] ;
153
+ }
154
+ path = path !== '/' ? `/${ path . split ( '/' ) . filter ( p => p !== '' ) . join ( '/' ) } ` : '' ;
155
+ message += `\n ${ method } - ${ endpointInfo } ${ path } ` ;
156
+ }
157
+ } ) ;
154
158
}
155
159
} ) ;
156
- } ) ;
160
+ }
157
161
message += '\n' ;
158
162
this . serverless . cli . consoleLog ( message ) ;
159
163
}
0 commit comments