Skip to content

Commit b33830d

Browse files
committed
Require all necessary APIs
1 parent d2b50a5 commit b33830d

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/deploy/functions/prepare.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,20 @@ export async function prepare(
6060
return;
6161
}
6262

63-
// NOTE: this will eventually be enalbed for everyone once AR is enabled
64-
// for GCFv1
63+
// Note: Some of these are premium APIs that require billing to be enabled.
64+
// We'd eventually have to add special error handling for billing APIs, but
65+
// enableCloudBuild is called above and has this special casing already.
6566
if (wantBackend.cloudFunctions.find((f) => f.platform === "gcfv2")) {
66-
await ensureApiEnabled.ensure(
67-
context.projectId,
68-
"artifactregistry.googleapis.com",
69-
"artifactregistry"
70-
);
67+
const V2_APIS = {
68+
"artifactregistry": "artifactregistry.googleapis.com",
69+
"cloudrun": "run.googleapis.com",
70+
"eventarc": "eventarc.googleapis.com",
71+
"pubsub": "pubsub.googleapis.com",
72+
};
73+
const enablements = Object.entries(V2_APIS).map(([tag, api]) => {
74+
return ensureApiEnabled.ensure(context.projectId, api, tag)
75+
});
76+
await Promise.all(enablements);
7177
}
7278

7379
// Prepare the functions directory for upload, and set context.triggers.

0 commit comments

Comments
 (0)