Skip to content

Commit

Permalink
Fix domain deleting when fail on not exist stack
Browse files Browse the repository at this point in the history
When stack not exists `findApiId()` fails on `getStack()` and then on `getNestedStack()`. Try block in `removeBasePathMappings()` do not set `externalBasePathExists` flag. As result domain that has other mappings are removed. This fix adds extra check to catch block of `removeBasePathMappings()` if option `preserveExternalPathMappings` is set in stack config (by setting this option user identify that domain should have another mappings) and set the flag `externalBasePathExists` that prevent removing domain.
  • Loading branch information
0vvland committed Apr 7, 2024
1 parent 4b17c05 commit 6f72d9d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ class ServerlessCustomDomain {
`Unable to remove base path mappings for '${domain.givenDomainName}':\n${err.message}`
);
}
if (domain.preserveExternalPathMappings) {
externalBasePathExists = true;
}
}

if (domain.autoDomain === true && !externalBasePathExists) {
Expand Down

0 comments on commit 6f72d9d

Please sign in to comment.