Skip to content

Commit 3dde9a3

Browse files
authored
Merge pull request #3 from nicoandra/master
Fixes stage being ignored when set in provider
2 parents b5ea652 + 153786e commit 3dde9a3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,16 @@ class ServerlessStepFunctionsLocal {
1313
this.log = serverless.cli.log.bind(serverless.cli);
1414
this.config = (this.service.custom && this.service.custom.stepFunctionsLocal) || {};
1515

16+
if (this.service.stage !== undefined) {
17+
this.stage = this.service.stage;
18+
} else if (this.service.provider !== undefined && this.service.provider.stage !== undefined) {
19+
this.stage = this.service.provider.stage;
20+
} else {
21+
this.stage = 'dev';
22+
}
23+
1624
// Check config
17-
if (!this.config.accountId) {
25+
if (this.config.accountId === undefined) {
1826
throw new Error('Step Functions Local: missing accountId');
1927
}
2028

@@ -214,7 +222,7 @@ class ServerlessStepFunctionsLocal {
214222
switch (state.Type) {
215223
case 'Task':
216224
if (state.Resource && state.Resource['Fn::GetAtt'] && Array.isArray(state.Resource['Fn::GetAtt'])) {
217-
state.Resource = `arn:aws:lambda:${this.config.region}:${this.config.accountId}:function:${this.service.service}-${this.serverless.stage ? this.serverless.stage : 'dev'}-${state.Resource['Fn::GetAtt'][0]}`
225+
state.Resource = `arn:aws:lambda:${this.config.region}:${this.config.accountId}:function:${this.service.service}-${this.stage}-${state.Resource['Fn::GetAtt'][0]}`
218226
}
219227
break;
220228
case 'Map':

0 commit comments

Comments
 (0)