Skip to content

Commit

Permalink
Fix stage name handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aoskotsky-amplify committed May 12, 2023
1 parent 1af9b67 commit 9e86fea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/aws/api-gateway-v1-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class APIGatewayV1Wrapper extends APIGatewayBase {
basePath: domain.basePath,
domainName: domain.givenDomainName,
restApiId: domain.apiId,
stage: domain.baseStage,
stage: domain.stage,
}));
Logging.logInfo(`V1 - Created API mapping '${domain.basePath}' for '${domain.givenDomainName}'`);
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions src/aws/api-gateway-v2-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class APIGatewayV2Wrapper extends APIGatewayBase {
* @param domain: DomainConfig
*/
public async createBasePathMapping(domain: DomainConfig): Promise<void> {
let stage = domain.baseStage;
let stage = domain.stage;
if (domain.apiType === Globals.apiTypes.http) {
// find a better way how to implement custom stage for the HTTP API type
stage = Globals.defaultStage;
Expand Down Expand Up @@ -171,7 +171,7 @@ class APIGatewayV2Wrapper extends APIGatewayBase {
* @param domain: DomainConfig
*/
public async updateBasePathMapping(domain: DomainConfig): Promise<void> {
let stage = domain.baseStage;
let stage = domain.stage;
if (domain.apiType === Globals.apiTypes.http) {
// find a better way how to implement custom stage for the HTTP API type
stage = Globals.defaultStage;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class ServerlessCustomDomain {
}

// Remove all special characters
const safeStage = domain.baseStage.replace(/[^a-zA-Z0-9]/g, "");
const safeStage = domain.stage.replace(/[^a-zA-Z0-9]/g, "");
service.provider.compiledCloudFormationTemplate.Outputs[domainNameOutputKey] = {
Value: domain.givenDomainName,
Export: {
Expand Down

0 comments on commit 9e86fea

Please sign in to comment.