firebase-tools-with-isolate 15.36.0 → 15.38.0

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.
Files changed (104) hide show
  1. package/lib/accountExporter.js +1 -1
  2. package/lib/accountImporter.js +15 -10
  3. package/lib/apiv2.js +66 -12
  4. package/lib/appUtils.js +103 -40
  5. package/lib/appdistribution/client.js +5 -1
  6. package/lib/apptesting/parseTestFiles.js +1 -1
  7. package/lib/auth.js +1 -1
  8. package/lib/bin/progressiveHelp.js +1 -1
  9. package/lib/command.js +1 -2
  10. package/lib/commands/appdistribution-distribute.js +5 -3
  11. package/lib/commands/crashlytics-events-get.js +46 -0
  12. package/lib/commands/crashlytics-events-list.js +68 -0
  13. package/lib/commands/crashlytics-heapdumps-enable.js +3 -4
  14. package/lib/commands/crashlytics-heapdumps-status.js +5 -3
  15. package/lib/commands/crashlytics-issues-get.js +65 -0
  16. package/lib/commands/crashlytics-reports-get.js +267 -0
  17. package/lib/commands/crashlytics-reports-list.js +42 -0
  18. package/lib/commands/dataconnect-services-list.js +8 -2
  19. package/lib/commands/ext-dev-init.js +1 -1
  20. package/lib/commands/hosting-channel-open.js +4 -1
  21. package/lib/commands/index.js +10 -0
  22. package/lib/commands/open.js +3 -1
  23. package/lib/commands/serve.js +1 -1
  24. package/lib/commands/use.js +1 -1
  25. package/lib/config.js +1 -1
  26. package/lib/crashlytics/commandUtils.js +227 -0
  27. package/lib/crashlytics/events.js +71 -73
  28. package/lib/crashlytics/filters.js +1 -1
  29. package/lib/crashlytics/profilingManager.js +63 -16
  30. package/lib/crashlytics/reports.js +5 -1
  31. package/lib/dataconnect/client.js +14 -8
  32. package/lib/deploy/dataconnect/release.js +2 -2
  33. package/lib/deploy/firestore/prepare.js +23 -17
  34. package/lib/deploy/functions/cel.js +1 -1
  35. package/lib/deploy/functions/deploy.js +2 -1
  36. package/lib/deploy/functions/prepare.js +28 -0
  37. package/lib/deploy/functions/release/fabricator.js +27 -3
  38. package/lib/deploy/functions/release/planner.js +3 -0
  39. package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
  40. package/lib/deploy/functions/runtimes/python/index.js +3 -0
  41. package/lib/deploy/functions/runtimes/supported/index.js +10 -4
  42. package/lib/deploy/functions/runtimes/supported/types.js +13 -1
  43. package/lib/deploy/run/deploy.js +40 -35
  44. package/lib/deploy/run/prereqs.js +0 -3
  45. package/lib/downloadUtils.js +2 -1
  46. package/lib/emulator/download.js +1 -0
  47. package/lib/emulator/downloadableEmulatorInfo.json +31 -31
  48. package/lib/emulator/downloadableEmulators.js +14 -2
  49. package/lib/emulator/events/types.js +0 -6
  50. package/lib/emulator/functionsEmulator.js +73 -1
  51. package/lib/emulator/functionsEmulatorRuntime.js +2 -2
  52. package/lib/emulator/storage/cloudFunctions.js +0 -1
  53. package/lib/emulator/storage/rules/runtime.js +0 -3
  54. package/lib/emulator/taskQueue.js +0 -12
  55. package/lib/experiments.js +10 -0
  56. package/lib/extensions/extensionsHelper.js +1 -4
  57. package/lib/extensions/listExtensions.js +1 -1
  58. package/lib/extensions/replacements.json +2 -1
  59. package/lib/firestore/delete.js +2 -3
  60. package/lib/firestore/fsConfig.js +100 -41
  61. package/lib/frameworks/next/constants.js +17 -14
  62. package/lib/frameworks/next/index.js +2 -2
  63. package/lib/frameworks/next/utils.js +6 -8
  64. package/lib/gcp/cloudbilling.js +2 -2
  65. package/lib/gcp/cloudbuild.js +0 -77
  66. package/lib/gcp/cloudscheduler.js +12 -0
  67. package/lib/gcp/cloudtasks.js +0 -4
  68. package/lib/gcp/devConnect.js +0 -6
  69. package/lib/gcp/iam.js +15 -1
  70. package/lib/gcp/resourceManager.js +1 -14
  71. package/lib/gcp/runv2.js +0 -27
  72. package/lib/gcp/secretManager.js +2 -2
  73. package/lib/gcp/storage.js +87 -4
  74. package/lib/hosting/api.js +29 -23
  75. package/lib/hosting/implicitInit.js +1 -1
  76. package/lib/hosting/proxy.js +1 -1
  77. package/lib/init/features/dataconnect/sdk.js +15 -5
  78. package/lib/init/features/firestore/rules.js +1 -1
  79. package/lib/init/features/functions/index.js +2 -2
  80. package/lib/init/features/functions/npm-dependencies.js +1 -1
  81. package/lib/init/features/storage/rules.js +1 -1
  82. package/lib/localFunction.js +3 -3
  83. package/lib/management/apps.js +7 -0
  84. package/lib/management/database.js +1 -1
  85. package/lib/mcp/apps/init/mcp-app.js +1 -1
  86. package/lib/mcp/apps/update_environment/mcp-app.js +1 -1
  87. package/lib/mcp/index.js +10 -4
  88. package/lib/mcp/tools/core/get_environment.js +1 -1
  89. package/lib/mcp/tools/crashlytics/events.js +2 -5
  90. package/lib/mcp/tools/crashlytics/reports.js +5 -14
  91. package/lib/mcp/util/apptesting/availability.js +3 -2
  92. package/lib/mcp/util/crashlytics/availability.js +59 -12
  93. package/lib/mcp/util/dataconnect/converter.js +1 -1
  94. package/lib/mcp/util.js +4 -0
  95. package/lib/profileReport.js +1 -1
  96. package/lib/profiler.js +1 -1
  97. package/lib/requireAuth.js +11 -7
  98. package/lib/rulesDeploy.js +0 -1
  99. package/lib/throttler/throttler.js +1 -1
  100. package/lib/tsconfig.publish.tsbuildinfo +1 -1
  101. package/lib/utils.js +1 -1
  102. package/package.json +15 -12
  103. package/schema/firebase-config.json +9 -3
  104. package/standalone/package.json +6 -1
@@ -109,11 +109,11 @@ async function default_1(context, options) {
109
109
  async function deployedConnectors(serviceInfos) {
110
110
  let connectors = [];
111
111
  for (const si of serviceInfos) {
112
- connectors = connectors.concat(await (0, client_1.listConnectors)(si.serviceName));
112
+ connectors = connectors.concat(await (0, client_1.listConnectors)(si.serviceName, ["connectors.name", "nextPageToken"]));
113
113
  }
114
114
  return connectors;
115
115
  }
116
116
  async function deployedSchemas(serviceInfos) {
117
- const schemasPerService = await Promise.all(serviceInfos.map((si) => (0, client_1.listSchemas)(si.serviceName)));
117
+ const schemasPerService = await Promise.all(serviceInfos.map((si) => (0, client_1.listSchemas)(si.serviceName, ["schemas.name", "nextPageToken"])));
118
118
  return schemasPerService.flat();
119
119
  }
@@ -12,6 +12,7 @@ const api_1 = require("../../api");
12
12
  const error_1 = require("../../error");
13
13
  const types = require("../../firestore/api-types");
14
14
  const api_2 = require("../../firestore/api");
15
+ const DEFAULT_FIRESTORE_LOCATION = "nam5";
15
16
  function prepareRules(context, rulesDeploy, databaseId, rulesFile) {
16
17
  rulesDeploy.addFile(rulesFile, databaseId);
17
18
  context.firestore.rules.push({
@@ -73,11 +74,18 @@ async function createDatabase(context, options) {
73
74
  }
74
75
  catch (e) {
75
76
  if (e.status === 404) {
77
+ const locationId = firestoreCfg.location || DEFAULT_FIRESTORE_LOCATION;
78
+ if (options.dryRun) {
79
+ utils.logLabeledWarning("firestore", `Database ${clc.bold(firestoreCfg.database)} does not exist. A deploy would create it in ` +
80
+ `${clc.bold(locationId)}${firestoreCfg.location ? "" : " (the default, because firebase.json sets no location)"}. ` +
81
+ "Skipping database creation because this is a dry run.");
82
+ return true;
83
+ }
76
84
  utils.logLabeledBullet("firestore", `Creating the new Firestore database ${firestoreCfg.database}...`);
77
85
  const createDatabaseReq = {
78
86
  project: options.projectId,
79
87
  databaseId: firestoreCfg.database,
80
- locationId: firestoreCfg.location || "nam5",
88
+ locationId,
81
89
  type: types.DatabaseType.FIRESTORE_NATIVE,
82
90
  databaseEdition: edition,
83
91
  deleteProtectionState: types.DatabaseDeleteProtectionState.DISABLED,
@@ -88,25 +96,14 @@ async function createDatabase(context, options) {
88
96
  await api.createDatabase(createDatabaseReq);
89
97
  }
90
98
  }
99
+ return false;
91
100
  }
92
101
  async function default_1(context, options) {
93
102
  await (0, ensureApiEnabled_1.ensure)(context.projectId, (0, api_1.firestoreOrigin)(), "firestore");
94
103
  await (0, ensureApiEnabled_1.ensure)(context.projectId, (0, api_1.firestoreOrigin)(), "firestore");
95
- if (options.only) {
96
- const targets = options.only.split(",");
97
- const excludeRules = targets.includes("firestore:indexes");
98
- const excludeIndexes = targets.includes("firestore:rules");
99
- const includeRules = targets.includes("firestore:rules");
100
- const includeIndexes = targets.includes("firestore:indexes");
101
- const onlyFirestore = targets.includes("firestore");
102
- context.firestoreIndexes = !excludeIndexes || includeIndexes || onlyFirestore;
103
- context.firestoreRules = !excludeRules || includeRules || onlyFirestore;
104
- }
105
- else {
106
- context.firestoreIndexes = true;
107
- context.firestoreRules = true;
108
- }
109
104
  const firestoreConfigs = fsConfig.getFirestoreConfig(context.projectId, options);
105
+ context.firestoreIndexes = firestoreConfigs.some((config) => Boolean(config.indexes));
106
+ context.firestoreRules = firestoreConfigs.some((config) => Boolean(config.rules));
110
107
  if (!firestoreConfigs || firestoreConfigs.length === 0) {
111
108
  return;
112
109
  }
@@ -115,7 +112,7 @@ async function default_1(context, options) {
115
112
  context.firestore.rules = [];
116
113
  const rulesDeploy = new rulesDeploy_1.RulesDeploy(options, rulesDeploy_1.RulesetServiceType.CLOUD_FIRESTORE);
117
114
  context.firestore.rulesDeploy = rulesDeploy;
118
- await createDatabase(context, options);
115
+ const skippedDatabaseCreation = await createDatabase(context, options);
119
116
  for (const firestoreConfig of firestoreConfigs) {
120
117
  if (firestoreConfig.indexes) {
121
118
  prepareIndexes(context, options, firestoreConfig.database, firestoreConfig.indexes);
@@ -125,7 +122,16 @@ async function default_1(context, options) {
125
122
  }
126
123
  }
127
124
  if (context.firestore.rules.length > 0) {
128
- await rulesDeploy.compile();
125
+ try {
126
+ await rulesDeploy.compile();
127
+ }
128
+ catch (err) {
129
+ if (!skippedDatabaseCreation || (0, error_1.getErrStatus)(err) !== 403) {
130
+ throw err;
131
+ }
132
+ utils.logLabeledWarning("firestore", "Could not check the rules for compilation errors (HTTP 403), most likely because the " +
133
+ "project has no Firestore database yet. A deploy creates the database before it checks the rules.");
134
+ }
129
135
  }
130
136
  const rulesContext = context?.firestore?.rules;
131
137
  for (const ruleContext of rulesContext) {
@@ -100,7 +100,7 @@ function resolveExpression(wantType, expr, params) {
100
100
  return resolveComparison(expr, params);
101
101
  }
102
102
  else {
103
- throw new ExprParseError("CEL expression '" + expr + "' is of an unsupported form");
103
+ throw new ExprParseError(`CEL expression '${String(expr)}' is of an unsupported form`);
104
104
  }
105
105
  }
106
106
  function preprocessLists(wantType, expr, params) {
@@ -18,6 +18,7 @@ const experiments = require("../../experiments");
18
18
  const supported = require("./runtimes/supported");
19
19
  const backend_1 = require("./backend");
20
20
  const extensions_1 = require("../extensions");
21
+ const error_1 = require("../../error");
21
22
  const getProjectNumber_1 = require("../../getProjectNumber");
22
23
  const path = require("path");
23
24
  (0, tmp_1.setGracefulCleanup)();
@@ -115,7 +116,7 @@ async function uploadCodebase(context, projectNumber, codebase, wantBackend) {
115
116
  }
116
117
  }
117
118
  catch (err) {
118
- (0, utils_1.logWarning)(clc.yellow("functions:") + " Upload Error: " + err.message);
119
+ (0, utils_1.logWarning)(`${clc.yellow("functions:")} Upload Error: ${(0, error_1.getErrMsg)(err)}`);
119
120
  throw err;
120
121
  }
121
122
  }
@@ -10,6 +10,7 @@ exports.inferBlockingDetails = inferBlockingDetails;
10
10
  exports.resolveCpuAndConcurrency = resolveCpuAndConcurrency;
11
11
  exports.resolveDefaultTimeout = resolveDefaultTimeout;
12
12
  exports.loadCodebases = loadCodebases;
13
+ exports.ensureScheduleRegionsSupported = ensureScheduleRegionsSupported;
13
14
  exports.getExecutablePaths = getExecutablePaths;
14
15
  exports.stripStaleDartBuildIgnore = stripStaleDartBuildIgnore;
15
16
  exports.warnIfNewGenkitFunctionIsMissingSecrets = warnIfNewGenkitFunctionIsMissingSecrets;
@@ -51,6 +52,7 @@ const functional_1 = require("../../functional");
51
52
  const prepare_1 = require("../extensions/prepare");
52
53
  const prompt = require("../../prompt");
53
54
  const iam = require("../../gcp/iam");
55
+ const scheduler = require("../../gcp/cloudscheduler");
54
56
  const resourcemanager = require("../../gcp/resourceManager");
55
57
  exports.EVENTARC_SOURCE_ENV = "EVENTARC_CLOUD_EVENT_SOURCE";
56
58
  exports.DECLARATIVE_SECURITY_ETAG_LABEL = "firebase-declarative-security-etag";
@@ -342,6 +344,7 @@ async function prepare(context, options, payload) {
342
344
  const matchingBackend = backend.matchingBackend(wantBackend, (endpoint) => {
343
345
  return (0, functionsDeployHelper_1.endpointMatchesAnyFilter)(endpoint, context.filters);
344
346
  });
347
+ await ensureScheduleRegionsSupported(projectId, matchingBackend);
345
348
  await (0, prompts_1.promptForFailurePolicies)(options, matchingBackend, haveBackend);
346
349
  await (0, prompts_1.promptForMinInstances)(options, matchingBackend, haveBackend);
347
350
  await backend.checkAvailability(context, matchingBackend);
@@ -568,6 +571,31 @@ async function loadCodebases(config, options, firebaseConfig, runtimeConfig, fil
568
571
  }
569
572
  return wantBuilds;
570
573
  }
574
+ async function ensureScheduleRegionsSupported(projectId, want) {
575
+ const scheduled = backend
576
+ .allEndpoints(want)
577
+ .filter((ep) => backend.isScheduleTriggered(ep) && ep.platform === "gcfv2");
578
+ if (scheduled.length === 0) {
579
+ return;
580
+ }
581
+ let supported;
582
+ try {
583
+ supported = await scheduler.listLocations(projectId);
584
+ }
585
+ catch (err) {
586
+ logger_1.logger.debug(`Failed to list Cloud Scheduler locations: ${(0, error_1.getErrMsg)(err)}`);
587
+ return;
588
+ }
589
+ if (supported.length === 0) {
590
+ return;
591
+ }
592
+ const unsupported = scheduled.filter((ep) => !supported.includes(ep.region));
593
+ if (unsupported.length > 0) {
594
+ const fns = unsupported.map((ep) => `${ep.id}(${ep.region})`).join(", ");
595
+ throw new error_1.FirebaseError(`Cloud Scheduler is not available in the region of these scheduled functions: ${fns}. ` +
596
+ `Deploy them to a region that supports Cloud Scheduler: ${[...supported].sort().join(", ")}.`);
597
+ }
598
+ }
571
599
  function warnIfDartBackendHasUnsupportedTriggers(want) {
572
600
  const dartEndpoints = backend.allEndpoints(want).filter(triggerSupport_1.isDartEndpoint);
573
601
  if (dartEndpoints.length === 0) {
@@ -321,7 +321,7 @@ class Fabricator {
321
321
  await this.updateV1Function(update.endpoint, scraperV1);
322
322
  }
323
323
  else if (update.endpoint.platform === "gcfv2") {
324
- await this.updateV2Function(update.endpoint, scraperV2);
324
+ await this.updateV2Function(update.endpoint, scraperV2, update.failedCreate);
325
325
  }
326
326
  else if (update.endpoint.platform === "run") {
327
327
  await this.updateRunFunction(update);
@@ -496,6 +496,9 @@ class Fabricator {
496
496
  utils.logLabeledWarning("functions", "Updated function is not associated with a service. This deployment is in an unexpected state - please re-deploy your functions.");
497
497
  return;
498
498
  }
499
+ await this.setV2InvokerCreate(endpoint, serviceName);
500
+ }
501
+ async setV2InvokerCreate(endpoint, serviceName) {
499
502
  if (backend.isHttpsTriggered(endpoint)) {
500
503
  const invoker = endpoint.httpsTrigger.invoker || ["public"];
501
504
  if (!invoker.includes("private")) {
@@ -584,7 +587,7 @@ class Fabricator {
584
587
  .catch(rethrowAs(endpoint, "set invoker"));
585
588
  }
586
589
  }
587
- async updateV2Function(endpoint, scraper) {
590
+ async updateV2Function(endpoint, scraper, failedCreate = false) {
588
591
  const storageSource = this.sources[endpoint.codebase]?.storage;
589
592
  if (!storageSource) {
590
593
  logger_1.logger.debug("Precondition failed. Cannot update a GCFv2 function without storage");
@@ -628,6 +631,10 @@ class Fabricator {
628
631
  utils.logLabeledWarning("functions", "Updated function is not associated with a service. This deployment is in an unexpected state - please re-deploy your functions.");
629
632
  return;
630
633
  }
634
+ if (failedCreate) {
635
+ await this.setV2InvokerCreate(endpoint, serviceName);
636
+ return;
637
+ }
631
638
  let invoker;
632
639
  if (backend.isHttpsTriggered(endpoint)) {
633
640
  invoker = endpoint.httpsTrigger.invoker === null ? ["public"] : endpoint.httpsTrigger.invoker;
@@ -901,7 +908,24 @@ class Fabricator {
901
908
  const jobName = scheduler.jobNameForEndpoint(endpoint, endpoint.region);
902
909
  await this.executor
903
910
  .run(() => scheduler.deleteJob(jobName))
904
- .catch(rethrowAsUnlessNotFound(endpoint, "delete schedule"));
911
+ .catch(async (err) => {
912
+ if ((0, executor_1.parseErrorCode)(err) === 400 &&
913
+ !(await this.schedulerSupportsRegion(endpoint.project, endpoint.region))) {
914
+ logger_1.logger.debug(`Cloud Scheduler does not support ${endpoint.region}; no schedule to delete for ${endpoint.id}.`);
915
+ return;
916
+ }
917
+ return rethrowAsUnlessNotFound(endpoint, "delete schedule")(err);
918
+ });
919
+ }
920
+ async schedulerSupportsRegion(projectId, region) {
921
+ try {
922
+ const regions = await scheduler.listLocations(projectId);
923
+ return regions.length === 0 || regions.includes(region);
924
+ }
925
+ catch (err) {
926
+ logger_1.logger.debug(`Failed to list Cloud Scheduler locations: ${(0, error_1.getErrMsg)(err)}`);
927
+ return true;
928
+ }
905
929
  }
906
930
  async disableTaskQueue(endpoint) {
907
931
  await this.executor
@@ -74,6 +74,9 @@ function calculateUpdate(want, have) {
74
74
  if (needsDelete) {
75
75
  update.deleteAndRecreate = have;
76
76
  }
77
+ else if (have.platform === "gcfv2" && have.state === "FAILED" && !have.runServiceId) {
78
+ update.failedCreate = true;
79
+ }
77
80
  return update;
78
81
  }
79
82
  async function createDeploymentPlan(args) {
@@ -88,7 +88,7 @@ function assertKeyTypes(prefix, yaml, schema) {
88
88
  }
89
89
  }
90
90
  else {
91
- throw new error_1.FirebaseError("YAML validation is missing a handled type " + schema[key]);
91
+ throw new error_1.FirebaseError(`YAML validation is missing a handled type ${String(schema[key])}`);
92
92
  }
93
93
  }
94
94
  }
@@ -51,6 +51,9 @@ function getPythonBinary(runtime) {
51
51
  else if (runtime === "python314") {
52
52
  return "python3.14";
53
53
  }
54
+ else if (runtime === "python315") {
55
+ return "python3.15";
56
+ }
54
57
  (0, functional_1.assertExhaustive)(runtime, `Unhandled python runtime ${runtime}`);
55
58
  }
56
59
  class Delegate {
@@ -29,8 +29,8 @@ function isRuntime(maybe) {
29
29
  function runtimeIsLanguage(runtime, language) {
30
30
  return !!runtime && runtime.startsWith(language);
31
31
  }
32
- function latest(language, runtimes = Object.keys(types_1.RUNTIMES)) {
33
- const sorted = runtimes
32
+ function latest(language, runtimes) {
33
+ const sorted = (runtimes ?? Object.keys(types_1.RUNTIMES))
34
34
  .filter((s) => runtimeIsLanguage(s, language))
35
35
  .sort((left, right) => {
36
36
  const leftVersion = +left.substring(language.length);
@@ -42,7 +42,8 @@ function latest(language, runtimes = Object.keys(types_1.RUNTIMES)) {
42
42
  }
43
43
  return leftVersion - rightVersion;
44
44
  });
45
- const latest = utils.last(sorted);
45
+ const ga = runtimes ? [] : sorted.filter((r) => types_1.RUNTIMES[r]?.status === "GA");
46
+ const latest = utils.last(ga.length ? ga : sorted);
46
47
  if (!latest) {
47
48
  throw new error_1.FirebaseError(`Internal error trying to find the latest supported runtime for ${language}`, { exit: 1 });
48
49
  }
@@ -53,12 +54,17 @@ function isDecommissioned(runtime, now = new Date()) {
53
54
  return cutoff < now;
54
55
  }
55
56
  function guardVersionSupport(runtime, now = new Date()) {
56
- const { deprecationDate, decommissionDate } = types_1.RUNTIMES[runtime];
57
+ const { friendly, status, deprecationDate, decommissionDate } = types_1.RUNTIMES[runtime];
57
58
  const decommission = new Date(decommissionDate);
58
59
  if (now >= decommission) {
59
60
  throw new error_1.FirebaseError(`Runtime ${types_1.RUNTIMES[runtime].friendly} was decommissioned on ${decommissionDate}. To deploy ` +
60
61
  "you must first upgrade your runtime version.", { exit: 1 });
61
62
  }
63
+ if (status === "beta") {
64
+ utils.logLabeledWarning("functions", `Runtime ${friendly} is in Preview. Preview runtimes may change and are not recommended ` +
65
+ "for production workloads. See https://cloud.google.com/functions/docs/runtime-support " +
66
+ "for details.");
67
+ }
62
68
  const deprecation = new Date(deprecationDate);
63
69
  if (now >= deprecation) {
64
70
  utils.logLabeledWarning("functions", `Runtime ${types_1.RUNTIMES[runtime].friendly} was deprecated on ${deprecationDate} and will be ` +
@@ -57,7 +57,7 @@ exports.RUNTIMES = runtimes({
57
57
  friendly: "Node.js 22",
58
58
  status: "GA",
59
59
  deprecationDate: "2027-04-30",
60
- decommissionDate: "2028-10-31",
60
+ decommissionDate: "2027-10-31",
61
61
  },
62
62
  nodejs24: {
63
63
  friendly: "Node.js 24",
@@ -65,6 +65,12 @@ exports.RUNTIMES = runtimes({
65
65
  deprecationDate: "2028-04-30",
66
66
  decommissionDate: "2028-10-31",
67
67
  },
68
+ nodejs26: {
69
+ friendly: "Node.js 26",
70
+ status: "beta",
71
+ deprecationDate: "2029-04-30",
72
+ decommissionDate: "2029-10-31",
73
+ },
68
74
  python310: {
69
75
  friendly: "Python 3.10",
70
76
  status: "GA",
@@ -95,6 +101,12 @@ exports.RUNTIMES = runtimes({
95
101
  deprecationDate: "2030-10-10",
96
102
  decommissionDate: "2031-04-10",
97
103
  },
104
+ python315: {
105
+ friendly: "Python 3.15",
106
+ status: "GA",
107
+ deprecationDate: "2031-10-10",
108
+ decommissionDate: "2032-04-10",
109
+ },
98
110
  dart3: {
99
111
  friendly: "Dart 3",
100
112
  status: "experimental",
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deploy = deploy;
4
4
  exports.revisionTemplate = revisionTemplate;
5
+ exports.remoteBuildConfig = remoteBuildConfig;
5
6
  exports.localBuildTemplate = localBuildTemplate;
6
7
  const fs = require("fs");
7
8
  const os = require("os");
@@ -18,7 +19,8 @@ const util_1 = require("../apphosting/util");
18
19
  const buildEnv_1 = require("./buildEnv");
19
20
  const util_2 = require("./util");
20
21
  const DEPLOY_MESSAGE_ANNOTATION = "firebase.google.com/deploy-message";
21
- const ROLLOUT_TIMEOUT_MS = 10 * 60 * 1000;
22
+ const ROLLOUT_TIMEOUT_MS = 45 * 60 * 1000;
23
+ const LAUNCH_STAGE = "ALPHA";
22
24
  const NO_IMAGE = "scratch";
23
25
  async function deploy(context, options, payload) {
24
26
  for (const svc of payload.run?.services || []) {
@@ -32,11 +34,15 @@ async function deploy(context, options, payload) {
32
34
  }
33
35
  async function deployRemoteBuild(context, options, svc) {
34
36
  const { projectId } = context;
37
+ const { serviceId, region } = svc.config;
35
38
  const { buildFolder, appFolder } = (0, util_1.buildDirectory)(options.config.projectDir, svc.config.rootDir);
36
39
  const archive = await (0, util_1.createSourceDeployArchive)(toAppHostingConfig(svc.config), buildFolder, options.config.projectDir);
37
40
  const source = await upload(projectId, options, svc.config, archive);
38
- const image = await buildImage(projectId, svc, source, appFolder);
39
- const template = revisionTemplate(svc, image, options.message);
41
+ await artifactregistry.ensureDockerRepository(projectId, region, "cloud-run-source-deploy");
42
+ const imageRepository = `${region}-docker.pkg.dev/${projectId}/cloud-run-source-deploy/${serviceId}`;
43
+ const buildConfig = remoteBuildConfig(svc, imageRepository, appFolder);
44
+ const template = remoteBuildTemplate(svc, source, buildConfig, options.message);
45
+ (0, utils_1.logLabeledBullet)("run", `Building and deploying service ${serviceId} in ${region}...`);
40
46
  svc.deployed = await rollOut(projectId, svc, template);
41
47
  }
42
48
  async function deployLocalBuild(context, options, svc) {
@@ -94,41 +100,20 @@ async function sourceBucket(projectId, options, region) {
94
100
  },
95
101
  });
96
102
  }
97
- async function buildImage(projectId, svc, source, appFolder) {
98
- const { serviceId, region } = svc.config;
99
- await artifactregistry.ensureDockerRepository(projectId, region, "cloud-run-source-deploy");
100
- const imageUri = `${region}-docker.pkg.dev/${projectId}/cloud-run-source-deploy/${serviceId}:${Date.now()}`;
101
- (0, utils_1.logLabeledBullet)("run", `Building service ${serviceId} in ${region}...`);
102
- const buildpackBuild = {
103
- environmentVariables: {
104
- ...(appFolder ? { GOOGLE_BUILDABLE: appFolder } : {}),
105
- ...(0, buildEnv_1.nonSecretValues)(svc.buildEnv || {}),
106
- X_GOOGLE_TARGET_PLATFORM: "fah",
107
- FIREBASE_OUTPUT_BUNDLE_DIR: "/workspace/.apphosting",
108
- },
109
- };
110
- if (svc.baseImage) {
111
- buildpackBuild.baseImage = svc.baseImage;
112
- buildpackBuild.enableAutomaticUpdates = true;
113
- }
114
- await runv2.submitBuild(projectId, region, { storageSource: source, imageUri, buildpackBuild });
115
- return imageUri;
116
- }
117
- function revisionTemplate(svc, image, message) {
103
+ function revisionTemplate(svc, message) {
118
104
  const { serviceId, region } = svc.config;
119
105
  const template = svc.existing
120
106
  ? (0, utils_1.cloneDeep)(svc.existing.template)
121
- : { containers: [{ name: serviceId, image }] };
107
+ : { containers: [{ name: serviceId }] };
122
108
  delete template.revision;
123
109
  const container = (0, util_2.mainContainer)(template);
124
110
  if (!container) {
125
111
  throw new error_1.FirebaseError(`Service ${serviceId} in ${region} has no containers.`);
126
112
  }
127
- container.image = image;
128
- if (container.sourceCode) {
129
- delete container.sourceCode;
130
- delete container.command;
131
- }
113
+ delete container.image;
114
+ delete container.sourceCode;
115
+ delete container.buildConfig;
116
+ delete container.command;
132
117
  if (svc.baseImage) {
133
118
  container.baseImageUri = svc.baseImage;
134
119
  }
@@ -151,17 +136,35 @@ function revisionTemplate(svc, image, message) {
151
136
  }
152
137
  return template;
153
138
  }
139
+ function remoteBuildTemplate(svc, source, buildConfig, message) {
140
+ const template = revisionTemplate(svc, message);
141
+ const container = (0, util_2.mainContainer)(template);
142
+ container.sourceCode = { cloudStorageSource: source };
143
+ container.buildConfig = buildConfig;
144
+ return template;
145
+ }
146
+ function remoteBuildConfig(svc, imageRepository, appFolder) {
147
+ const env = {
148
+ ...(appFolder ? { GOOGLE_BUILDABLE: appFolder } : {}),
149
+ ...(0, buildEnv_1.nonSecretValues)(svc.buildEnv || {}),
150
+ X_GOOGLE_TARGET_PLATFORM: "fah",
151
+ FIREBASE_OUTPUT_BUNDLE_DIR: "/workspace/.apphosting",
152
+ };
153
+ return {
154
+ imageRepositoryUri: imageRepository,
155
+ environmentVariables: Object.entries(env).map(([name, value]) => ({ name, value })),
156
+ buildpacksBuild: svc.baseImage ? { buildBaseImageUri: svc.baseImage } : {},
157
+ };
158
+ }
154
159
  function localBuildTemplate(svc, build, builtApp, message) {
155
- const template = revisionTemplate(svc, NO_IMAGE, message);
160
+ const template = revisionTemplate(svc, message);
156
161
  const container = (0, util_2.mainContainer)(template);
162
+ container.image = NO_IMAGE;
157
163
  container.sourceCode = { cloudStorageSource: builtApp };
158
164
  const command = build.runCommand?.trim();
159
165
  if (command) {
160
166
  container.command = command.split(/\s+/);
161
167
  }
162
- else {
163
- delete container.command;
164
- }
165
168
  if (build.env.length) {
166
169
  const buildNames = new Set(build.env.map((e) => e.name));
167
170
  const otherEnv = (container.env || []).filter((e) => !buildNames.has(e.name));
@@ -195,6 +198,7 @@ function createNewService(projectId, config, template, annotations) {
195
198
  client: "cli-firebase",
196
199
  invokerIamDisabled: true,
197
200
  ingress: "INGRESS_TRAFFIC_ALL",
201
+ launchStage: LAUNCH_STAGE,
198
202
  };
199
203
  return runv2.createService(projectId, region, serviceId, service, {
200
204
  pollTimeoutMs: ROLLOUT_TIMEOUT_MS,
@@ -209,9 +213,10 @@ function deployRevision(service, template, annotations) {
209
213
  annotations,
210
214
  template,
211
215
  traffic: [{ type: "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST", percent: 100 }, ...tags],
216
+ launchStage: LAUNCH_STAGE,
212
217
  };
213
218
  return runv2.updateService(update, {
214
- updateMask: ["template", "traffic", "annotations"],
219
+ updateMask: ["template", "traffic", "annotations", "launchStage"],
215
220
  pollTimeoutMs: ROLLOUT_TIMEOUT_MS,
216
221
  });
217
222
  }
@@ -10,13 +10,10 @@ exports.RUN_PERMISSIONS = [
10
10
  "run.services.update",
11
11
  "run.services.setIamPolicy",
12
12
  "run.operations.get",
13
- "cloudbuild.builds.create",
14
- "cloudbuild.builds.get",
15
13
  "storage.buckets.list",
16
14
  "storage.buckets.create",
17
15
  "artifactregistry.repositories.get",
18
16
  "artifactregistry.repositories.create",
19
- "artifactregistry.repositories.downloadArtifacts",
20
17
  "iam.serviceAccounts.actAs",
21
18
  ];
22
19
  async function prereqs(projectId) {
@@ -54,12 +54,13 @@ function validateChecksum(filepath, expectedChecksum, algorithm = "md5") {
54
54
  return new Promise((resolve, reject) => {
55
55
  const hash = crypto.createHash(algorithm);
56
56
  const stream = fs.createReadStream(filepath);
57
+ stream.on("error", reject);
57
58
  stream.on("data", (data) => hash.update(data));
58
59
  stream.on("end", () => {
59
60
  const checksum = hash.digest("hex");
60
61
  return checksum === expectedChecksum
61
62
  ? resolve()
62
- : reject(new error_1.FirebaseError(`download failed, expected checksum ${expectedChecksum} but got ${checksum}`, { exit: 1 }));
63
+ : reject(new error_1.FirebaseError(`download failed, expected ${algorithm} checksum ${expectedChecksum} but got ${checksum}`, { exit: 1 }));
63
64
  });
64
65
  });
65
66
  }
@@ -37,6 +37,7 @@ async function downloadEmulator(name) {
37
37
  if (!emulator.opts.skipChecksumAndSize) {
38
38
  await downloadUtils.validateSize(tmpfile, emulator.opts.expectedSize);
39
39
  await downloadUtils.validateChecksum(tmpfile, emulator.opts.expectedChecksum, "md5");
40
+ await downloadUtils.validateChecksum(tmpfile, emulator.opts.expectedChecksumSHA256, "sha256");
40
41
  }
41
42
  if (emulator.opts.skipCache) {
42
43
  removeOldFiles(name, emulator, true);
@@ -44,46 +44,46 @@
44
44
  }
45
45
  },
46
46
  "pubsub": {
47
- "version": "0.8.37",
48
- "expectedSize": 53029797,
49
- "expectedChecksum": "62cc150027ebea586c2c53c48c2cbb25",
50
- "expectedChecksumSHA256": "c83383e0c71633e58abad6fdc9c0312c7d0f6a5a34236c42e3f92eb24ded1c26",
51
- "remoteUrl": "https://storage.googleapis.com/firebase-preview-drop/emulator/pubsub-emulator-0.8.37.zip",
52
- "downloadPathRelativeToCacheDir": "pubsub-emulator-0.8.37.zip",
53
- "binaryPathRelativeToCacheDir": "pubsub-emulator-0.8.37/pubsub-emulator/bin/cloud-pubsub-emulator"
47
+ "version": "0.8.38",
48
+ "expectedSize": 53069962,
49
+ "expectedChecksum": "8d7d921ade2b88b5bf1c5b2e17394c9b",
50
+ "expectedChecksumSHA256": "1f7e272f9d86431026c4219468a91eea90f0d32fc178da6a96cd1a843517e619",
51
+ "remoteUrl": "https://storage.googleapis.com/firebase-preview-drop/emulator/pubsub-emulator-0.8.38.zip",
52
+ "downloadPathRelativeToCacheDir": "pubsub-emulator-0.8.38.zip",
53
+ "binaryPathRelativeToCacheDir": "pubsub-emulator-0.8.38/pubsub-emulator/bin/cloud-pubsub-emulator"
54
54
  },
55
55
  "dataconnect": {
56
56
  "darwin": {
57
- "version": "3.4.26",
58
- "expectedSize": 35802400,
59
- "expectedChecksum": "7b412320648e289a5302f92dedaf4924",
60
- "expectedChecksumSHA256": "f7c131c9158548b40e64a86cf27bb7e8de5cd5601ad7eb0771130053abbabd95",
61
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.26",
62
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.26"
57
+ "version": "3.4.29",
58
+ "expectedSize": 38102624,
59
+ "expectedChecksum": "24499c43b5cce5c07064af5ab87046db",
60
+ "expectedChecksumSHA256": "c3bcb0a6dbca1b04ef67630941691af89d8b95bf00ae69efa1f5eff9305f4fdb",
61
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.29",
62
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29"
63
63
  },
64
64
  "darwin_arm64": {
65
- "version": "3.4.26",
66
- "expectedSize": 33762002,
67
- "expectedChecksum": "35c444137e843a16db4d4b37afea2b9c",
68
- "expectedChecksumSHA256": "5e872d05c130efe374b5174a5afffb06cab7b3739bac59d8e660ee168160f895",
69
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.26",
70
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.26"
65
+ "version": "3.4.29",
66
+ "expectedSize": 35919234,
67
+ "expectedChecksum": "efd8df3f1132a3fb6b4b67f9709c3368",
68
+ "expectedChecksumSHA256": "9a91a2b8eb958aba24f44a3c23e4a97659bb14b62070d96c17418e0b4cb308ee",
69
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.29",
70
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29"
71
71
  },
72
72
  "win32": {
73
- "version": "3.4.26",
74
- "expectedSize": 35780608,
75
- "expectedChecksum": "1a9cdf0db3bc605772798b0cc075834d",
76
- "expectedChecksumSHA256": "9948f2f65067e4a9fa0a2648228664913c5f196f95ba674aee3ba4dbfed8a384",
77
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.26",
78
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.26.exe"
73
+ "version": "3.4.29",
74
+ "expectedSize": 38045696,
75
+ "expectedChecksum": "5207920425aa2a0ddbe59c882ae4edab",
76
+ "expectedChecksumSHA256": "04e04b118f944ec8076f478a60a30a77c7c9b8e2b089810c2a39f0e63c3fc371",
77
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.29",
78
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29.exe"
79
79
  },
80
80
  "linux": {
81
- "version": "3.4.26",
82
- "expectedSize": 34803874,
83
- "expectedChecksum": "ab8ed6eb387f6ba36d1cb3a793adac28",
84
- "expectedChecksumSHA256": "1c96d378ca7e95f5af3fef90f351d0142809916b0593a6dac39e6d7f276437c9",
85
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.26",
86
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.26"
81
+ "version": "3.4.29",
82
+ "expectedSize": 37007522,
83
+ "expectedChecksum": "7cb21f5c796ebda7e8e76d0a486d6cc0",
84
+ "expectedChecksumSHA256": "aa862456865a237290a7e51bc857c9139d603fe6e8a004116a4f7c400b67ac12",
85
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.29",
86
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.29"
87
87
  }
88
88
  }
89
89
  }