File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
const EventEmitter = require ( 'events' ) . EventEmitter ;
2
2
const util = require ( 'util' ) ;
3
3
const AWS = require ( 'aws-sdk' ) ;
4
+ var parser = require ( 'aws-arn-parser' ) ;
4
5
5
6
const Pooler = require ( './pooler.js' ) ;
6
7
const replaceError = require ( './replace-error.js' ) ;
@@ -28,7 +29,14 @@ function Worker(options) {
28
29
this . autoStart = typeof ( options . autoStart ) === 'boolean' ? options . autoStart : true ;
29
30
30
31
if ( ! options . activityArn ) {
31
- this . emit ( 'error' , new Error ( 'activityArn is mandatory inside Worker' ) ) ;
32
+ throw ( new Error ( 'activityArn is mandatory inside Worker' ) ) ;
33
+ return ;
34
+ }
35
+
36
+ const { region} = parser ( options . activityArn ) ;
37
+
38
+ if ( this . stepfunction . config . region !== region ) {
39
+ throw ( new Error ( `activity ARN region (${ region } ) should match with AWS Region (${ this . stepfunction . config . region } )` ) ) ;
32
40
return ;
33
41
}
34
42
Original file line number Diff line number Diff line change 37
37
"xo" : " ^0.18.2"
38
38
},
39
39
"dependencies" : {
40
+ "aws-arn-parser" : " ^1.0.0" ,
40
41
"aws-sdk" : " ^2.82.0"
41
42
}
42
43
}
You can’t perform that action at this time.
0 commit comments