firebase-tools 12.6.0 → 12.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,7 +40,7 @@ class AppDistributionClient {
40
40
  method: "POST",
41
41
  path: `/upload/v1/${appName}/releases:upload`,
42
42
  headers: {
43
- "X-Goog-Upload-File-Name": distribution.getFileName(),
43
+ "X-Goog-Upload-File-Name": encodeURIComponent(distribution.getFileName()),
44
44
  "X-Goog-Upload-Protocol": "raw",
45
45
  "Content-Type": "application/octet-stream",
46
46
  },
@@ -185,7 +185,7 @@ function toBackend(build, paramValues) {
185
185
  throw new error_1.FirebaseError("platform can't be undefined");
186
186
  }
187
187
  const bkEndpoint = Object.assign({ id: endpointId, project: bdEndpoint.project, region: region, entryPoint: bdEndpoint.entryPoint, platform: bdEndpoint.platform, runtime: bdEndpoint.runtime }, trigger);
188
- proto.copyIfPresent(bkEndpoint, bdEndpoint, "environmentVariables", "labels", "secretEnvironmentVariables", "serviceAccount");
188
+ proto.copyIfPresent(bkEndpoint, bdEndpoint, "environmentVariables", "labels", "secretEnvironmentVariables");
189
189
  proto.convertIfPresent(bkEndpoint, bdEndpoint, "ingressSettings", (from) => {
190
190
  if (from !== null && !backend.AllIngressSettings.includes(from)) {
191
191
  throw new error_1.FirebaseError(`Cannot set ingress settings to invalid value ${from}`);
@@ -199,6 +199,7 @@ function toBackend(build, paramValues) {
199
199
  }
200
200
  return mem || null;
201
201
  });
202
+ r.resolveStrings(bkEndpoint, bdEndpoint, "serviceAccount");
202
203
  r.resolveInts(bkEndpoint, bdEndpoint, "timeoutSeconds", "maxInstances", "minInstances", "concurrency");
203
204
  proto.convertIfPresent(bkEndpoint, bdEndpoint, "cpu", (0, functional_1.nullsafeVisitor)((cpu) => (cpu === "gcf_gen1" ? cpu : r.resolveInt(cpu))));
204
205
  if (bdEndpoint.vpc) {
@@ -91,7 +91,7 @@ async function createFunction(cloudFunction) {
91
91
  const components = cloudFunction.name.split("/");
92
92
  const functionId = components.splice(-1, 1)[0];
93
93
  cloudFunction.buildConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.buildConfig.environmentVariables), { GOOGLE_NODE_RUN_SCRIPTS: "" });
94
- cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: functionId });
94
+ cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: functionId.replace("-", ".") });
95
95
  try {
96
96
  const res = await client.post(components.join("/"), cloudFunction, { queryParams: { functionId } });
97
97
  return res.body;
@@ -149,7 +149,7 @@ async function updateFunction(cloudFunction) {
149
149
  const fieldMasks = proto.fieldMasks(cloudFunction, "labels", "serviceConfig.environmentVariables", "serviceConfig.secretEnvironmentVariables");
150
150
  cloudFunction.buildConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.buildConfig.environmentVariables), { GOOGLE_NODE_RUN_SCRIPTS: "" });
151
151
  fieldMasks.push("buildConfig.buildEnvironmentVariables");
152
- cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: functionId });
152
+ cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: functionId.replace("-", ".") });
153
153
  try {
154
154
  const queryParams = {
155
155
  updateMask: fieldMasks.join(","),
@@ -6,19 +6,21 @@ const api_1 = require("../api");
6
6
  const apiv2_1 = require("../apiv2");
7
7
  const error_1 = require("../error");
8
8
  const logger_1 = require("../logger");
9
- const projects_1 = require("../management/projects");
9
+ const ensureApiEnabled_1 = require("../ensureApiEnabled");
10
10
  async function getDefaultBucket(projectId) {
11
11
  var _a;
12
+ await (0, ensureApiEnabled_1.ensure)(projectId, "firebasestorage.googleapis.com", "storage", false);
12
13
  try {
13
- const metadata = await (0, projects_1.getFirebaseProject)(projectId);
14
- if (!((_a = metadata.resources) === null || _a === void 0 ? void 0 : _a.storageBucket)) {
14
+ const localAPIClient = new apiv2_1.Client({ urlPrefix: api_1.firebaseStorageOrigin, apiVersion: "v1alpha" });
15
+ const response = await localAPIClient.get(`/projects/${projectId}/defaultBucket`);
16
+ if (!((_a = response.body) === null || _a === void 0 ? void 0 : _a.name)) {
15
17
  logger_1.logger.debug("Default storage bucket is undefined.");
16
18
  throw new error_1.FirebaseError("Your project is being set up. Please wait a minute before deploying again.");
17
19
  }
18
- return metadata.resources.storageBucket;
20
+ return response.body.name;
19
21
  }
20
22
  catch (err) {
21
- logger_1.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.");
23
+ logger_1.logger.info("\n\nThere was an issue deploying your Storage rules. 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.");
22
24
  throw err;
23
25
  }
24
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "12.6.0",
3
+ "version": "12.6.1",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {