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

Better error message for missing storage default bucket #6575

Merged
merged 3 commits into from
Dec 6, 2023
Merged
Changes from all commits
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
12 changes: 9 additions & 3 deletions src/gcp/storage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Readable } from "stream";
import * as path from "path";
import * as clc from "colorette";

import { firebaseStorageOrigin, storageOrigin } from "../api";
import { Client } from "../apiv2";
Expand Down Expand Up @@ -162,9 +163,14 @@ export async function getDefaultBucket(projectId: string): Promise<string> {
}
return response.body.bucket.name.split("/").pop()!;
} catch (err: any) {
logger.info(
"\n\nThere was an issue deploying your functions. Verify that your project has a Google App Engine instance setup at https://console.cloud.google.com/appengine and try again. If this issue persists, please contact support."
);
if (err?.status === 404) {
throw new FirebaseError(
`Firebase Storage has not been set up on project '${clc.bold(
projectId
)}'. Go to https://console.firebase.google.com/project/${projectId}/storage and click 'Get Started' to set up Firebase Storage.`
);
}
logger.info("\n\nUnexpected error when fetching default storage bucket.");
throw err;
}
}
Expand Down
Loading