Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added descriptive error when repo is private or not found during ext:dev:upload. #6052

Merged
merged 6 commits into from
Jun 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Formatting.
apascal07 committed Jun 21, 2023
commit fa2623ab9c216614debd739c96efeeedb6b96fce
9 changes: 3 additions & 6 deletions src/extensions/extensionsHelper.ts
Original file line number Diff line number Diff line change
@@ -737,21 +737,18 @@ async function fetchExtensionSource(
logger.info(`Validating source code at ${clc.bold(sourceUri)}...`);
const archiveUri = `${repoUri}/archive/${sourceRef}.zip`;
const tempDirectory = tmp.dirSync({ unsafeCleanup: true });
const archiveErrorMessage = `Failed to extract archive from ${archiveUri}. Please check that the repo is public and that the source ref is valid.`;
try {
const response = await fetch(archiveUri);
if (response.ok) {
await response.body.pipe(createUnzipTransform(tempDirectory.name)).promise();
}
} catch (err: any) {
throw new FirebaseError(
`Failed to fetch extension archive from ${archiveUri}. Please check the repo URI and source ref. ${err}`
);
throw new FirebaseError(archiveErrorMessage);
}
const archiveName = fs.readdirSync(tempDirectory.name)[0];
if (!archiveName) {
throw new FirebaseError(
`Failed to extract archive from ${archiveUri}. Please check that the repo is public and that the source ref is valid.`
);
throw new FirebaseError(archiveErrorMessage);
}
const rootDirectory = path.join(tempDirectory.name, archiveName, extensionRoot);
// Pre-validation to show a more useful error message in the context of a temp directory.