diff --git a/lib/deploy/events/apiGateway/deployment.js b/lib/deploy/events/apiGateway/deployment.js index 66bde844..d1aa7f81 100644 --- a/lib/deploy/events/apiGateway/deployment.js +++ b/lib/deploy/events/apiGateway/deployment.js @@ -27,9 +27,11 @@ module.exports = { [ 'https://', this.provider.getApiGatewayRestApiId(), - `.execute-api.${this.options.region}.`, + '.execute-api.', + { Ref: 'AWS::Region' }, + '.', { Ref: 'AWS::URLSuffix' }, - `/${this.options.stage}`, + `/${this.provider.getStage()}`, ], ], }, diff --git a/lib/deploy/events/apiGateway/deployment.test.js b/lib/deploy/events/apiGateway/deployment.test.js index 7dc7cf31..639c685c 100644 --- a/lib/deploy/events/apiGateway/deployment.test.js +++ b/lib/deploy/events/apiGateway/deployment.test.js @@ -59,7 +59,9 @@ describe('#compileDeployment()', () => { [ 'https://', { Ref: serverlessStepFunctions.apiGatewayRestApiLogicalId }, - '.execute-api.us-east-1.', + '.execute-api.', + { Ref: 'AWS::Region' }, + '.', { Ref: 'AWS::URLSuffix' }, '/dev', ],