firebase-tools 14.9.0 → 14.10.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.
@@ -152,7 +152,7 @@ async function createGitRepoLink(projectId, location, connectionId) {
152
152
  await githubConnections.linkGitHubRepository(projectId, location, connectionId);
153
153
  }
154
154
  exports.createGitRepoLink = createGitRepoLink;
155
- async function ensureAppHostingComputeServiceAccount(projectId, serviceAccount, deployFromSource = false) {
155
+ async function ensureAppHostingComputeServiceAccount(projectId, serviceAccount) {
156
156
  const sa = serviceAccount || defaultComputeServiceAccountEmail(projectId);
157
157
  const name = `projects/${projectId}/serviceAccounts/${sa}`;
158
158
  try {
@@ -162,21 +162,14 @@ async function ensureAppHostingComputeServiceAccount(projectId, serviceAccount,
162
162
  if (!(err instanceof error_1.FirebaseError)) {
163
163
  throw err;
164
164
  }
165
- if (err.status === 404) {
166
- await provisionDefaultComputeServiceAccount(projectId);
167
- }
168
- else if (err.status === 403) {
165
+ if (err.status === 403) {
169
166
  throw new error_1.FirebaseError(`Failed to create backend due to missing delegation permissions for ${sa}. Make sure you have the iam.serviceAccounts.actAs permission.`, { original: err });
170
167
  }
171
- }
172
- if (deployFromSource) {
173
- const policy = await (0, resourceManager_1.getIamPolicy)(projectId);
174
- const objectViewerBinding = policy.bindings.find((binding) => binding.role === "roles/storage.objectViewer");
175
- if (!objectViewerBinding ||
176
- !objectViewerBinding.members.includes(`serviceAccount:${defaultComputeServiceAccountEmail(projectId)}`)) {
177
- await (0, resourceManager_1.addServiceAccountToRoles)(projectId, defaultComputeServiceAccountEmail(projectId), ["roles/storage.objectViewer"], true);
168
+ else if (err.status !== 404) {
169
+ throw new error_1.FirebaseError("Unexpected error occurred while testing for IAM service account permissions", { original: err });
178
170
  }
179
171
  }
172
+ await provisionDefaultComputeServiceAccount(projectId);
180
173
  }
181
174
  exports.ensureAppHostingComputeServiceAccount = ensureAppHostingComputeServiceAccount;
182
175
  async function promptNewBackendId(projectId, location) {
@@ -232,12 +225,22 @@ async function provisionDefaultComputeServiceAccount(projectId) {
232
225
  throw err;
233
226
  }
234
227
  }
235
- await (0, resourceManager_1.addServiceAccountToRoles)(projectId, defaultComputeServiceAccountEmail(projectId), [
236
- "roles/firebaseapphosting.computeRunner",
237
- "roles/firebase.sdkAdminServiceAgent",
238
- "roles/developerconnect.readTokenAccessor",
239
- "roles/storage.objectViewer",
240
- ], true);
228
+ try {
229
+ await (0, resourceManager_1.addServiceAccountToRoles)(projectId, defaultComputeServiceAccountEmail(projectId), [
230
+ "roles/firebaseapphosting.computeRunner",
231
+ "roles/firebase.sdkAdminServiceAgent",
232
+ "roles/developerconnect.readTokenAccessor",
233
+ "roles/storage.objectViewer",
234
+ ], true);
235
+ }
236
+ catch (err) {
237
+ if ((0, error_1.getErrStatus)(err) === 400) {
238
+ (0, utils_1.logWarning)("Your App Hosting compute service account is still being provisioned in the background. If you encounter an error, please try again after a few moments.");
239
+ }
240
+ else {
241
+ throw err;
242
+ }
243
+ }
241
244
  }
242
245
  async function setDefaultTrafficPolicy(projectId, location, backendId, codebaseBranch) {
243
246
  const traffic = {
@@ -13,15 +13,7 @@ async function default_1(context, options) {
13
13
  const projectId = (0, projectUtils_1.needProjectId)(options);
14
14
  await (0, apphosting_1.ensureApiEnabled)(options);
15
15
  await (0, backend_1.ensureRequiredApisEnabled)(projectId);
16
- try {
17
- await (0, backend_1.ensureAppHostingComputeServiceAccount)(projectId, "", true);
18
- }
19
- catch (err) {
20
- if (err.status === 400) {
21
- (0, utils_1.logLabeledWarning)("apphosting", "Your App Hosting compute service account is still being provisioned. Please try again in a few moments.");
22
- }
23
- throw err;
24
- }
16
+ await (0, backend_1.ensureAppHostingComputeServiceAccount)(projectId, "");
25
17
  context.backendConfigs = new Map();
26
18
  context.backendLocations = new Map();
27
19
  context.backendStorageUris = new Map();
@@ -358,6 +358,7 @@ async function startAll(options, showUI = true, runningTestScript = false) {
358
358
  if (extensionEmulator) {
359
359
  await startEmulator(extensionEmulator);
360
360
  }
361
+ const account = (0, auth_1.getProjectDefaultAccount)(options.projectRoot);
361
362
  if (emulatableBackends.length) {
362
363
  if (!listenForEmulator.functions || !listenForEmulator.eventarc || !listenForEmulator.tasks) {
363
364
  listenForEmulator = await (0, portUtils_1.resolveHostAndAssignPorts)(Object.assign(Object.assign({}, listenForEmulator), { functions: (_h = listenForEmulator.functions) !== null && _h !== void 0 ? _h : getListenConfig(options, types_1.Emulators.FUNCTIONS), eventarc: (_j = listenForEmulator.eventarc) !== null && _j !== void 0 ? _j : getListenConfig(options, types_1.Emulators.EVENTARC), tasks: (_k = listenForEmulator.eventarc) !== null && _k !== void 0 ? _k : getListenConfig(options, types_1.Emulators.TASKS) }));
@@ -378,7 +379,6 @@ async function startAll(options, showUI = true, runningTestScript = false) {
378
379
  if (emulatorsNotRunning.length > 0 && !constants_1.Constants.isDemoProject(projectId)) {
379
380
  functionsLogger.logLabeled("WARN", "functions", `The following emulators are not running, calls to these services from the Functions emulator will affect production: ${clc.bold(emulatorsNotRunning.join(", "))}`);
380
381
  }
381
- const account = (0, auth_1.getProjectDefaultAccount)(options.projectRoot);
382
382
  const functionsEmulator = new functionsEmulator_1.FunctionsEmulator({
383
383
  projectId,
384
384
  projectDir,
@@ -574,6 +574,7 @@ async function startAll(options, showUI = true, runningTestScript = false) {
574
574
  enable_output_generated_sdk: true,
575
575
  enable_output_schema_extensions: true,
576
576
  debug: options.debug,
577
+ account,
577
578
  };
578
579
  if (exportMetadata.dataconnect) {
579
580
  utils.assertIsString(options.import);
@@ -44,7 +44,6 @@ BEGIN
44
44
  END
45
45
  $do$;`;
46
46
  const decoder = new node_string_decoder_1.StringDecoder();
47
- const pgliteDebugLog = fs.createWriteStream("pglite-debug.log");
48
47
  class PostgresServer {
49
48
  async createPGServer(host = "127.0.0.1", port) {
50
49
  const getDb = this.getDb.bind(this);
@@ -244,6 +243,7 @@ class PGliteExtendedQueryPatch {
244
243
  this.connection = connection;
245
244
  this.isExtendedQuery = false;
246
245
  this.eqpErrored = false;
246
+ this.pgliteDebugLog = fs.createWriteStream("pglite-debug.log");
247
247
  }
248
248
  filterResponse(message, response) {
249
249
  return __asyncGenerator(this, arguments, function* filterResponse_1() {
@@ -254,7 +254,7 @@ class PGliteExtendedQueryPatch {
254
254
  pg_gateway_1.FrontendMessageCode.Close,
255
255
  ];
256
256
  const decoded = decoder.write(message);
257
- pgliteDebugLog.write("Front: " + decoded);
257
+ this.pgliteDebugLog.write("Front: " + decoded);
258
258
  if (pipelineStartMessages.includes(message[0])) {
259
259
  this.isExtendedQuery = true;
260
260
  }
@@ -275,10 +275,10 @@ class PGliteExtendedQueryPatch {
275
275
  this.eqpErrored = true;
276
276
  }
277
277
  if (this.isExtendedQuery && bm[0] === pg_gateway_1.BackendMessageCode.ReadyForQuery) {
278
- pgliteDebugLog.write("Filtered: " + decoder.write(bm));
278
+ this.pgliteDebugLog.write("Filtered: " + decoder.write(bm));
279
279
  continue;
280
280
  }
281
- pgliteDebugLog.write("Sent: " + decoder.write(bm));
281
+ this.pgliteDebugLog.write("Sent: " + decoder.write(bm));
282
282
  yield yield __await(bm);
283
283
  }
284
284
  finally {
@@ -250,7 +250,6 @@ class DataConnectEmulator {
250
250
  if (account) {
251
251
  const defaultCredPath = await (0, defaultCredentials_1.getCredentialPathAsync)(account);
252
252
  if (defaultCredPath) {
253
- logger_1.logger.log("DEBUG", `Setting GAC to ${defaultCredPath}`);
254
253
  credsEnv.GOOGLE_APPLICATION_CREDENTIALS = defaultCredPath;
255
254
  }
256
255
  }
@@ -54,28 +54,28 @@
54
54
  },
55
55
  "dataconnect": {
56
56
  "darwin": {
57
- "version": "2.8.0",
58
- "expectedSize": 29279072,
59
- "expectedChecksum": "0381ba8dd2eb67629cbbf4a88b276850",
60
- "expectedChecksumSHA256": "bc88bca96c83df21f7ed4b66c2a518ca48a21ba259fe481c0911fb5010d2fa0f",
61
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-v2.8.0",
62
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-2.8.0"
57
+ "version": "2.9.1",
58
+ "expectedSize": 29307744,
59
+ "expectedChecksum": "b6c7485c7a25b703610172a5718e372c",
60
+ "expectedChecksumSHA256": "2442af6068478fad6e202412ed41a9bb4ca663c27286e654042a346e8c7f1557",
61
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-v2.9.1",
62
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-2.9.1"
63
63
  },
64
64
  "win32": {
65
- "version": "2.8.0",
66
- "expectedSize": 29769216,
67
- "expectedChecksum": "622e7c7e23b0bd7592ad5a0ca0934987",
68
- "expectedChecksumSHA256": "c23484eaf8f1ac68653bb29bb307de9d1c47a1fc4005610b094772e7ac368512",
69
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-v2.8.0",
70
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-2.8.0.exe"
65
+ "version": "2.9.1",
66
+ "expectedSize": 29797888,
67
+ "expectedChecksum": "643ed6d0ef81488dc23f2ef5247d3f6f",
68
+ "expectedChecksumSHA256": "ffc2723ce25ffedb958b848c71fcda5bf488208e9d2ef4310ac4f41d6533934d",
69
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-v2.9.1",
70
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-2.9.1.exe"
71
71
  },
72
72
  "linux": {
73
- "version": "2.8.0",
74
- "expectedSize": 29208760,
75
- "expectedChecksum": "dd9b1b9a55761f4d763a11bb7b84cbff",
76
- "expectedChecksumSHA256": "7ffe98a28e9c185ddb07cdbf1610dc86747083afca9ac8cb850214ca8f1147c4",
77
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-v2.8.0",
78
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-2.8.0"
73
+ "version": "2.9.1",
74
+ "expectedSize": 29233336,
75
+ "expectedChecksum": "4ae414db7c87ebe8da9fe12139203d67",
76
+ "expectedChecksumSHA256": "777e5ee6661cce1874f8c363d06ca446838b0e98840ec51b9aa8a79af6565db7",
77
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-v2.9.1",
78
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-2.9.1"
79
79
  }
80
80
  }
81
81
  }
@@ -33,7 +33,8 @@ function setNewDefaults(params, newDefaults) {
33
33
  if (newDefaults[param.param]) {
34
34
  param.default = newDefaults[param.param];
35
35
  }
36
- else if ((param.param = `firebaseextensions.v1beta.function/location` && newDefaults["LOCATION"])) {
36
+ else if (param.param === `firebaseextensions.v1beta.function/location` &&
37
+ newDefaults["LOCATION"]) {
37
38
  param.default = newDefaults["LOCATION"];
38
39
  }
39
40
  }
@@ -22,17 +22,7 @@ async function doSetup(setup, config) {
22
22
  }
23
23
  await (0, apphosting_1.ensureApiEnabled)({ projectId });
24
24
  await (0, backend_1.ensureRequiredApisEnabled)(projectId);
25
- const spinner = ora("Checking your App Hosting compute service account...").start();
26
- try {
27
- await (0, backend_1.ensureAppHostingComputeServiceAccount)(projectId, "", true);
28
- spinner.succeed("App Hosting compute Service account is ready");
29
- }
30
- catch (err) {
31
- if (err.status === 400) {
32
- spinner.warn("Your App Hosting compute service account is still being provisioned. Please try again in a few moments.");
33
- }
34
- throw err;
35
- }
25
+ await (0, backend_1.ensureAppHostingComputeServiceAccount)(projectId, "");
36
26
  utils.logBullet("This command links your local project to Firebase App Hosting. You will be able to deploy your web app with `firebase deploy` after setup.");
37
27
  const backendConfig = {
38
28
  backendId: "",
@@ -12,7 +12,7 @@ exports.list_top_issues = (0, tool_js_1.tool)({
12
12
  app_id: zod_1.z
13
13
  .string()
14
14
  .optional()
15
- .describe("AppId for which the issues list is fetched. Defaults to the first appId provided by firebase_list_apps."),
15
+ .describe("AppId for which the issues list should be fetched. For an Android application, read the mobilesdk_app_id value specified in the google-services.json file for the current package name. For an iOS Application, read the GOOGLE_APP_ID from GoogleService-Info.plist. If neither is available, use the `firebase_list_apps` tool to find an app_id to pass to this tool."),
16
16
  issue_count: zod_1.z
17
17
  .number()
18
18
  .optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "14.9.0",
3
+ "version": "14.10.1",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {