@@ -203,7 +203,7 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
203203 } ) ;
204204 }
205205
206- getRawConfig ( ) : Promise < any > {
206+ async getRawConfig ( ) : Promise < ServerlessWithError [ 'service' ] > {
207207 const serverlessPath = this . serverless . config . servicePath ;
208208 if ( ! serverlessPath ) {
209209 throw new this . serverless . classes . Error ( 'Could not find serverless manifest' ) ;
@@ -220,9 +220,15 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
220220 `Could not find serverless manifest at path ${ serverlessPath } . If this path is incorreect you should adjust the 'servicePath' variable`
221221 ) ;
222222 }
223-
223+ let fromFile : ServerlessWithError [ 'service' ] ;
224224 if ( / \. j s o n | \. j s $ / . test ( manifestFilename ) ) {
225- return import ( manifestFilename ) ;
225+ try {
226+ fromFile = await import ( manifestFilename ) ;
227+ return fromFile ;
228+ } catch ( err ) {
229+ console . error ( err ) ;
230+ throw new Error ( `Unable to import manifest at: ${ manifestFilename } ` ) ;
231+ }
226232 }
227233
228234 return this . serverless . yamlParser . parse ( manifestFilename ) ;
@@ -288,7 +294,7 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
288294 return { handler : handlerName , filePath } ;
289295 }
290296
291- buildStepWorkFlow ( ) : ReturnType < StepFunctionsOfflinePlugin [ 'process' ] > {
297+ async buildStepWorkFlow ( ) : Promise < ReturnType < StepFunctionsOfflinePlugin [ 'process' ] > > {
292298 this . cliLog ( 'Building StepWorkFlow' ) ;
293299 if ( ! this . stateDefinition ) throw new Error ( 'Missing state definition' ) ;
294300 const event = this . loadedEventFile ?? { } ;
@@ -359,7 +365,7 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
359365 if ( contextObject ) {
360366 if ( func instanceof Promise ) {
361367 return func . then ( async mod => {
362- if ( ! mod ) return ;
368+ if ( ! mod ) return contextObject . done ( null , { } ) ;
363369 let res ;
364370 let err ;
365371 try {
0 commit comments