Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2a2268e

Browse files
inlineddevpeerapong
authored andcommittedDec 14, 2021
Bugbash fixes (firebase#3644)
* Print function names on validation errors, not [Object object] * Require all necessary APIs * Remove import eslint module The import module does not currenty handle package exports. The author is apparently of the opinion that exports should not use renaming features. Until this is fixed, all of the v2 API is broken. See import-js/eslint-plugin-import#1810 for more info. * Linter fixes
1 parent 36716d2 commit 2a2268e

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
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.

‎src/deploy/functions/validate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function functionIdsAreValid(functions: { id: string; platform: string }[
3838
});
3939
if (invalidV1Ids.length !== 0) {
4040
const msg =
41-
`${invalidV1Ids.join(", ")} function name(s) can only contain letters, ` +
41+
`${invalidV1Ids.map((f) => f.id).join(", ")} function name(s) can only contain letters, ` +
4242
`numbers, hyphens, and not exceed 62 characters in length`;
4343
throw new FirebaseError(msg);
4444
}
@@ -49,7 +49,7 @@ export function functionIdsAreValid(functions: { id: string; platform: string }[
4949
});
5050
if (invalidV2Ids.length !== 0) {
5151
const msg =
52-
`${invalidV2Ids.join(", ")} v2 function name(s) can only contin lower ` +
52+
`${invalidV2Ids.map((f) => f.id).join(", ")} v2 function name(s) can only contin lower ` +
5353
`case letters, numbers, hyphens, and not exceed 62 characters in length`;
5454
throw new FirebaseError(msg);
5555
}

‎templates/init/functions/typescript/_eslintrc

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ module.exports = {
2222
],
2323
plugins: [
2424
"@typescript-eslint",
25-
"import",
2625
],
2726
rules: {
2827
quotes: ["error", "double"],

0 commit comments

Comments
 (0)
Please sign in to comment.