Skip to content

Commit e1f0d8d

Browse files
apascal07joehan
andauthored
Added descriptive error when repo is private or not found during ext:dev:upload. (#6052)
* Added more descriptive error message when repo is private (or not found). * Formatting. * Formatting. * Update CHANGELOG.md --------- Co-authored-by: joehan <[email protected]>
1 parent 893971f commit e1f0d8d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- Increased extension instance create poll timeout to 1h to match backend (#5969).
22
- Refactored `ext:install` to use the latest extension metadata. (#5997)
3+
- Added descriptive error when repo is private or not found during `ext:dev:upload`. (#6052)
34
- Fixed issue where missing trigger warnings would be wrongly displayed when emulating extensions with HTTPS triggers. (#6055)
45
- Normalized extension root path before usage in `ext:dev:upload`. (#6054)

src/extensions/extensionsHelper.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -729,17 +729,21 @@ async function fetchExtensionSource(
729729
logger.info(`Validating source code at ${clc.bold(sourceUri)}...`);
730730
const archiveUri = `${repoUri}/archive/${sourceRef}.zip`;
731731
const tempDirectory = tmp.dirSync({ unsafeCleanup: true });
732+
const archiveErrorMessage = `Failed to extract archive from ${clc.bold(
733+
archiveUri
734+
)}. Please check that the repo is public and that the source ref is valid.`;
732735
try {
733736
const response = await fetch(archiveUri);
734737
if (response.ok) {
735738
await response.body.pipe(createUnzipTransform(tempDirectory.name)).promise();
736739
}
737740
} catch (err: any) {
738-
throw new FirebaseError(
739-
`Failed to fetch extension archive from ${archiveUri}. Please check the repo URI and source ref. ${err}`
740-
);
741+
throw new FirebaseError(archiveErrorMessage);
741742
}
742743
const archiveName = fs.readdirSync(tempDirectory.name)[0];
744+
if (!archiveName) {
745+
throw new FirebaseError(archiveErrorMessage);
746+
}
743747
const rootDirectory = path.join(tempDirectory.name, archiveName, extensionRoot);
744748
// Pre-validation to show a more useful error message in the context of a temp directory.
745749
try {

0 commit comments

Comments
 (0)