Skip to content

Commit c8c3df1

Browse files
authored
Better error message for missing storage default bucket (#6575)
* Better error message for missing storage default bucket * === * ===
1 parent 874569c commit c8c3df1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/gcp/storage.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Readable } from "stream";
22
import * as path from "path";
3+
import * as clc from "colorette";
34

45
import { firebaseStorageOrigin, storageOrigin } from "../api";
56
import { Client } from "../apiv2";
@@ -162,9 +163,14 @@ export async function getDefaultBucket(projectId: string): Promise<string> {
162163
}
163164
return response.body.bucket.name.split("/").pop()!;
164165
} catch (err: any) {
165-
logger.info(
166-
"\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."
167-
);
166+
if (err?.status === 404) {
167+
throw new FirebaseError(
168+
`Firebase Storage has not been set up on project '${clc.bold(
169+
projectId
170+
)}'. Go to https://console.firebase.google.com/project/${projectId}/storage and click 'Get Started' to set up Firebase Storage.`
171+
);
172+
}
173+
logger.info("\n\nUnexpected error when fetching default storage bucket.");
168174
throw err;
169175
}
170176
}

0 commit comments

Comments
 (0)