fix: prevent unhandled promise rejection in apps:destroy#3679
Merged
Conversation
Fixes unhandled promise rejection when removing git remotes after app destruction. The command successfully deleted the app but crashed during git remote cleanup. Two bugs fixed: 1. Promise.all nested array issue - .map() returns Array<Promise>, not a single Promise - Promise.all([array, array]) doesn't await inner promises - Resulted in fire-and-forget promises with unhandled rejections 2. Duplicate remote removal - listRemotes() groups by URL, same remote name appears twice - Once for (fetch) and once for (push) - Second rmRemote() call failed: "No such remote" Solution: - Flatten promise arrays by collecting remote names first - Deduplicate names using Set (removes fetch/push duplicates) - Then create promises and await them properly Closes #3677
Expanded GitService class to include all git operations needed for testing, allowing easy stubbing of git methods in unit tests. Added two new tests: - Verifies deduplication works with single remote (fetch + push) - Verifies deduplication works with multiple remotes Fixes #3677
5a7ece8 to
b69a518
Compare
sbosio
approved these changes
Apr 22, 2026
Contributor
sbosio
left a comment
There was a problem hiding this comment.
Looks like it'll require small lint fixes, but otherwise looking great, so I'm approving!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes unhandled promise rejection when removing git remotes after app destruction in
apps:destroy. The command successfully deleted the app but crashed during git remote cleanup with exit code 1.Root cause: Two bugs in the Promise.all usage:
.map()returnsArray<Promise>, butPromise.all([array, array])doesn't await inner promises, making them fire-and-forgetlistRemotes()returns same remote name twice (fetch + push), causing secondrmRemote()to fail with "No such remote"Solution:
Type of Change
Patch Updates (patch semver update)
Testing
Notes:
This fix resolves the issue reported in #3677 where apps:destroy would crash after successfully deleting the app.
Steps::
Related Issues
GitHub issue: #3677