firebase-tools 15.36.0 → 15.37.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.
- package/lib/accountExporter.js +1 -1
- package/lib/accountImporter.js +7 -6
- package/lib/apiv2.js +0 -1
- package/lib/apptesting/parseTestFiles.js +1 -1
- package/lib/auth.js +1 -1
- package/lib/bin/progressiveHelp.js +1 -1
- package/lib/command.js +1 -2
- package/lib/commands/crashlytics-events-get.js +48 -0
- package/lib/commands/crashlytics-events-list.js +70 -0
- package/lib/commands/crashlytics-heapdumps-enable.js +3 -4
- package/lib/commands/crashlytics-heapdumps-status.js +5 -3
- package/lib/commands/crashlytics-issues-get.js +61 -0
- package/lib/commands/crashlytics-reports-get.js +179 -0
- package/lib/commands/crashlytics-reports-list.js +42 -0
- package/lib/commands/dataconnect-services-list.js +8 -2
- package/lib/commands/ext-dev-init.js +1 -1
- package/lib/commands/hosting-channel-open.js +4 -1
- package/lib/commands/index.js +10 -0
- package/lib/commands/open.js +3 -1
- package/lib/commands/serve.js +1 -1
- package/lib/commands/use.js +1 -1
- package/lib/config.js +1 -1
- package/lib/crashlytics/commandUtils.js +194 -0
- package/lib/crashlytics/events.js +8 -8
- package/lib/crashlytics/filters.js +1 -1
- package/lib/crashlytics/profilingManager.js +63 -16
- package/lib/crashlytics/reports.js +5 -1
- package/lib/dataconnect/client.js +14 -8
- package/lib/deploy/dataconnect/release.js +2 -2
- package/lib/deploy/firestore/prepare.js +21 -3
- package/lib/deploy/functions/cel.js +1 -1
- package/lib/deploy/functions/deploy.js +2 -1
- package/lib/deploy/functions/prepare.js +28 -0
- package/lib/deploy/functions/release/fabricator.js +27 -3
- package/lib/deploy/functions/release/planner.js +3 -0
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/supported/index.js +10 -4
- package/lib/deploy/functions/runtimes/supported/types.js +7 -1
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/functionsEmulator.js +73 -1
- package/lib/emulator/functionsEmulatorRuntime.js +2 -2
- package/lib/experiments.js +5 -0
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/firestore/delete.js +2 -3
- package/lib/frameworks/next/constants.js +17 -14
- package/lib/frameworks/next/index.js +25 -3
- package/lib/frameworks/next/utils.js +6 -8
- package/lib/gcp/cloudbilling.js +2 -2
- package/lib/gcp/cloudbuild.js +0 -77
- package/lib/gcp/cloudscheduler.js +12 -0
- package/lib/gcp/cloudtasks.js +0 -4
- package/lib/gcp/devConnect.js +0 -6
- package/lib/gcp/iam.js +15 -1
- package/lib/gcp/resourceManager.js +1 -14
- package/lib/gcp/storage.js +87 -4
- package/lib/hosting/api.js +0 -7
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/proxy.js +1 -1
- package/lib/init/features/firestore/rules.js +1 -1
- package/lib/init/features/functions/index.js +2 -2
- package/lib/init/features/functions/npm-dependencies.js +1 -1
- package/lib/init/features/storage/rules.js +1 -1
- package/lib/localFunction.js +3 -3
- package/lib/management/database.js +1 -1
- package/lib/mcp/apps/init/mcp-app.js +1 -1
- package/lib/mcp/apps/update_environment/mcp-app.js +1 -1
- package/lib/mcp/index.js +6 -2
- package/lib/mcp/tools/crashlytics/reports.js +2 -2
- package/lib/mcp/util/dataconnect/converter.js +1 -1
- package/lib/profileReport.js +1 -1
- package/lib/profiler.js +1 -1
- package/lib/rulesDeploy.js +0 -1
- package/lib/throttler/throttler.js +1 -1
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +1 -1
- package/package.json +8 -7
- package/schema/firebase-config.json +3 -0
|
@@ -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";
|
|
@@ -336,6 +338,7 @@ async function prepare(context, options, payload) {
|
|
|
336
338
|
const matchingBackend = backend.matchingBackend(wantBackend, (endpoint) => {
|
|
337
339
|
return (0, functionsDeployHelper_1.endpointMatchesAnyFilter)(endpoint, context.filters);
|
|
338
340
|
});
|
|
341
|
+
await ensureScheduleRegionsSupported(projectId, matchingBackend);
|
|
339
342
|
await (0, prompts_1.promptForFailurePolicies)(options, matchingBackend, haveBackend);
|
|
340
343
|
await (0, prompts_1.promptForMinInstances)(options, matchingBackend, haveBackend);
|
|
341
344
|
await backend.checkAvailability(context, matchingBackend);
|
|
@@ -562,6 +565,31 @@ async function loadCodebases(config, options, firebaseConfig, runtimeConfig, fil
|
|
|
562
565
|
}
|
|
563
566
|
return wantBuilds;
|
|
564
567
|
}
|
|
568
|
+
async function ensureScheduleRegionsSupported(projectId, want) {
|
|
569
|
+
const scheduled = backend
|
|
570
|
+
.allEndpoints(want)
|
|
571
|
+
.filter((ep) => backend.isScheduleTriggered(ep) && ep.platform === "gcfv2");
|
|
572
|
+
if (scheduled.length === 0) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
let supported;
|
|
576
|
+
try {
|
|
577
|
+
supported = await scheduler.listLocations(projectId);
|
|
578
|
+
}
|
|
579
|
+
catch (err) {
|
|
580
|
+
logger_1.logger.debug(`Failed to list Cloud Scheduler locations: ${(0, error_1.getErrMsg)(err)}`);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
if (supported.length === 0) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const unsupported = scheduled.filter((ep) => !supported.includes(ep.region));
|
|
587
|
+
if (unsupported.length > 0) {
|
|
588
|
+
const fns = unsupported.map((ep) => `${ep.id}(${ep.region})`).join(", ");
|
|
589
|
+
throw new error_1.FirebaseError(`Cloud Scheduler is not available in the region of these scheduled functions: ${fns}. ` +
|
|
590
|
+
`Deploy them to a region that supports Cloud Scheduler: ${[...supported].sort().join(", ")}.`);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
565
593
|
function warnIfDartBackendHasUnsupportedTriggers(want) {
|
|
566
594
|
const dartEndpoints = backend.allEndpoints(want).filter(triggerSupport_1.isDartEndpoint);
|
|
567
595
|
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(
|
|
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(
|
|
91
|
+
throw new error_1.FirebaseError(`YAML validation is missing a handled type ${String(schema[key])}`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -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
|
|
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
|
|
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: "
|
|
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",
|
|
@@ -44,46 +44,46 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"pubsub": {
|
|
47
|
-
"version": "0.8.
|
|
48
|
-
"expectedSize":
|
|
49
|
-
"expectedChecksum": "
|
|
50
|
-
"expectedChecksumSHA256": "
|
|
51
|
-
"remoteUrl": "https://storage.googleapis.com/firebase-preview-drop/emulator/pubsub-emulator-0.8.
|
|
52
|
-
"downloadPathRelativeToCacheDir": "pubsub-emulator-0.8.
|
|
53
|
-
"binaryPathRelativeToCacheDir": "pubsub-emulator-0.8.
|
|
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.
|
|
58
|
-
"expectedSize":
|
|
59
|
-
"expectedChecksum": "
|
|
60
|
-
"expectedChecksumSHA256": "
|
|
61
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.
|
|
62
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
57
|
+
"version": "3.4.28",
|
|
58
|
+
"expectedSize": 36296112,
|
|
59
|
+
"expectedChecksum": "85f315cee8bf94af8eedfff7c51a2a72",
|
|
60
|
+
"expectedChecksumSHA256": "d6824ee803bbd4579a6b75af38c0079a882071b017024afe2502de21867098f7",
|
|
61
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.28",
|
|
62
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.28"
|
|
63
63
|
},
|
|
64
64
|
"darwin_arm64": {
|
|
65
|
-
"version": "3.4.
|
|
66
|
-
"expectedSize":
|
|
67
|
-
"expectedChecksum": "
|
|
68
|
-
"expectedChecksumSHA256": "
|
|
69
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.
|
|
70
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
65
|
+
"version": "3.4.28",
|
|
66
|
+
"expectedSize": 34214194,
|
|
67
|
+
"expectedChecksum": "3781a39f4acdaee1645abc7ae3f72152",
|
|
68
|
+
"expectedChecksumSHA256": "2b35d5eae39d57a8666c3771ddad7c09e7189534ecfbb1ef0891c3c6d507d733",
|
|
69
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.28",
|
|
70
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.28"
|
|
71
71
|
},
|
|
72
72
|
"win32": {
|
|
73
|
-
"version": "3.4.
|
|
74
|
-
"expectedSize":
|
|
75
|
-
"expectedChecksum": "
|
|
76
|
-
"expectedChecksumSHA256": "
|
|
77
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.
|
|
78
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
73
|
+
"version": "3.4.28",
|
|
74
|
+
"expectedSize": 36275200,
|
|
75
|
+
"expectedChecksum": "4cb3b2b72860464b92f438136da86d63",
|
|
76
|
+
"expectedChecksumSHA256": "bffb0dedacc979673130c6e5802a13cda0e98e74769a2618c06ed2683bfe1040",
|
|
77
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.28",
|
|
78
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.28.exe"
|
|
79
79
|
},
|
|
80
80
|
"linux": {
|
|
81
|
-
"version": "3.4.
|
|
82
|
-
"expectedSize":
|
|
83
|
-
"expectedChecksum": "
|
|
84
|
-
"expectedChecksumSHA256": "
|
|
85
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.
|
|
86
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
81
|
+
"version": "3.4.28",
|
|
82
|
+
"expectedSize": 35291298,
|
|
83
|
+
"expectedChecksum": "4fa5bc3ecfadc4c246d7b72e89b5b38d",
|
|
84
|
+
"expectedChecksumSHA256": "b70a3d7fe9a0feb99710d387e7a9ab4cac9c4c7b9e687ae60d391cef959f214f",
|
|
85
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.28",
|
|
86
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.28"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FunctionsEmulator = exports.TCPConn = exports.IPCConn = void 0;
|
|
4
4
|
exports.createIgnoredFilter = createIgnoredFilter;
|
|
5
|
+
exports.getAllowedEmulatorUIOrigins = getAllowedEmulatorUIOrigins;
|
|
5
6
|
const fs = require("fs");
|
|
6
7
|
const path = require("path");
|
|
7
8
|
const express = require("express");
|
|
@@ -14,6 +15,7 @@ const events_1 = require("events");
|
|
|
14
15
|
const logger_1 = require("../logger");
|
|
15
16
|
const track_1 = require("../track");
|
|
16
17
|
const constants_1 = require("./constants");
|
|
18
|
+
const dns_1 = require("./dns");
|
|
17
19
|
const types_1 = require("./types");
|
|
18
20
|
const chokidar = require("chokidar");
|
|
19
21
|
const minimatch = require("minimatch");
|
|
@@ -85,6 +87,60 @@ function createIgnoredFilter(ignore) {
|
|
|
85
87
|
}
|
|
86
88
|
return ignored;
|
|
87
89
|
}
|
|
90
|
+
const LOOPBACK_AND_WILDCARD_HOSTS = [
|
|
91
|
+
"localhost",
|
|
92
|
+
dns_1.IPV4_LOOPBACK.address,
|
|
93
|
+
dns_1.IPV6_LOOPBACK.address,
|
|
94
|
+
dns_1.IPV4_UNSPECIFIED.address,
|
|
95
|
+
dns_1.IPV6_UNSPECIFIED.address,
|
|
96
|
+
];
|
|
97
|
+
function addOrigin(origins, options) {
|
|
98
|
+
const { protocol, host, port } = options;
|
|
99
|
+
const formattedHost = host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
|
|
100
|
+
const portSuffix = port !== undefined ? `:${port}` : "";
|
|
101
|
+
try {
|
|
102
|
+
origins.add(new url_1.URL(`${protocol}://${formattedHost}${portSuffix}`).origin);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function getAllowedEmulatorUIOrigins() {
|
|
108
|
+
const uiInfo = registry_1.EmulatorRegistry.getInfo(types_1.Emulators.UI);
|
|
109
|
+
if (!uiInfo) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
const origins = new Set();
|
|
113
|
+
const specs = uiInfo.listen?.length
|
|
114
|
+
? uiInfo.listen
|
|
115
|
+
: [
|
|
116
|
+
{
|
|
117
|
+
address: uiInfo.host,
|
|
118
|
+
port: uiInfo.port,
|
|
119
|
+
family: uiInfo.host.includes(":") ? "IPv6" : "IPv4",
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
for (const spec of specs) {
|
|
123
|
+
const { address, port } = spec;
|
|
124
|
+
if (LOOPBACK_AND_WILDCARD_HOSTS.includes(address)) {
|
|
125
|
+
addOrigin(origins, { protocol: "http", host: "localhost", port });
|
|
126
|
+
addOrigin(origins, { protocol: "http", host: dns_1.IPV4_LOOPBACK.address, port });
|
|
127
|
+
addOrigin(origins, { protocol: "http", host: dns_1.IPV6_LOOPBACK.address, port });
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
addOrigin(origins, { protocol: "http", host: address, port });
|
|
131
|
+
}
|
|
132
|
+
if (process.env.WEB_HOST) {
|
|
133
|
+
addOrigin(origins, { protocol: "https", host: `${port}-${process.env.WEB_HOST}` });
|
|
134
|
+
}
|
|
135
|
+
if (process.env.CODESPACE_NAME && process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN) {
|
|
136
|
+
addOrigin(origins, {
|
|
137
|
+
protocol: "https",
|
|
138
|
+
host: `${process.env.CODESPACE_NAME}-${port}.${process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return Array.from(origins);
|
|
143
|
+
}
|
|
88
144
|
class FunctionsEmulator {
|
|
89
145
|
static getHttpFunctionUrl(projectId, name, region, info) {
|
|
90
146
|
let url;
|
|
@@ -223,10 +279,26 @@ class FunctionsEmulator {
|
|
|
223
279
|
}
|
|
224
280
|
res.json({ status: "multicast_acknowledged" });
|
|
225
281
|
};
|
|
282
|
+
const rejectDisallowedBackendsOrigin = (req, res, next) => {
|
|
283
|
+
const origin = req.headers.origin;
|
|
284
|
+
if (origin && !getAllowedEmulatorUIOrigins().includes(origin)) {
|
|
285
|
+
res.status(403).json({
|
|
286
|
+
message: `/backends cannot be accessed by external callers.`,
|
|
287
|
+
});
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
next();
|
|
291
|
+
};
|
|
292
|
+
const listBackendsCors = cors({
|
|
293
|
+
origin: (origin, callback) => {
|
|
294
|
+
callback(null, Boolean(origin));
|
|
295
|
+
},
|
|
296
|
+
});
|
|
226
297
|
const listBackendsHandler = (req, res) => {
|
|
227
298
|
res.json({ backends: this.getBackendInfo() });
|
|
228
299
|
};
|
|
229
|
-
hub.
|
|
300
|
+
hub.options(listBackendsRoute, rejectDisallowedBackendsOrigin, listBackendsCors);
|
|
301
|
+
hub.get(listBackendsRoute, rejectDisallowedBackendsOrigin, listBackendsCors, listBackendsHandler);
|
|
230
302
|
hub.post(backgroundFunctionRoute, dataMiddleware, httpsHandler);
|
|
231
303
|
hub.post(multicastFunctionRoute, dataMiddleware, multicastHandler);
|
|
232
304
|
hub.all(httpsFunctionRoutes, dataMiddleware, httpsHandler);
|
|
@@ -293,8 +293,8 @@ async function initializeFirebaseAdminStubs() {
|
|
|
293
293
|
new types_1.EmulatorLog("WARN_ONCE", "runtime-status", "The Firebase Authentication emulator is running, but your 'firebase-admin' dependency is below version 9.3.0, so calls to Firebase Authentication will affect production.").log();
|
|
294
294
|
}
|
|
295
295
|
else if ((0, functionsEmulatorUtils_1.compareVersionStrings)(adminResolution.version, "9.4.2") <= 0) {
|
|
296
|
-
const auth = defaultApp.auth();
|
|
297
|
-
if (typeof auth
|
|
296
|
+
const auth = typeof defaultApp.auth === "function" ? defaultApp.auth() : undefined;
|
|
297
|
+
if (typeof auth?.setJwtVerificationEnabled === "function") {
|
|
298
298
|
logDebug("auth.setJwtVerificationEnabled(false)", {});
|
|
299
299
|
auth.setJwtVerificationEnabled(false);
|
|
300
300
|
}
|
package/lib/experiments.js
CHANGED
|
@@ -228,6 +228,11 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
228
228
|
default: false,
|
|
229
229
|
public: false,
|
|
230
230
|
},
|
|
231
|
+
crashlyticscli: {
|
|
232
|
+
shortDescription: "Enable read-only Crashlytics commands for issues, events, and reports.",
|
|
233
|
+
default: false,
|
|
234
|
+
public: false,
|
|
235
|
+
},
|
|
231
236
|
});
|
|
232
237
|
function isValidExperiment(name) {
|
|
233
238
|
return Object.keys(exports.ALL_EXPERIMENTS).includes(name);
|
|
@@ -48,7 +48,7 @@ async function listExtensions(projectId) {
|
|
|
48
48
|
publisher = extension.split("/")[0];
|
|
49
49
|
}
|
|
50
50
|
const instanceId = (0, utils_1.last)(instance.name.split("/")) ?? "";
|
|
51
|
-
const state = instance.state +
|
|
51
|
+
const state = String(instance.state) +
|
|
52
52
|
((instance.config.source.state || "ACTIVE") === "DELETED" ? " (UNPUBLISHED)" : "");
|
|
53
53
|
const version = instance?.config?.source?.spec?.version;
|
|
54
54
|
const updateTime = extensionsUtils.formatTimestamp(instance.updateTime);
|
package/lib/firestore/delete.js
CHANGED
|
@@ -16,7 +16,6 @@ class FirestoreDelete {
|
|
|
16
16
|
this.path = path || "";
|
|
17
17
|
this.recursive = Boolean(options.recursive);
|
|
18
18
|
this.shallow = Boolean(options.shallow);
|
|
19
|
-
this.allCollections = Boolean(options.allCollections);
|
|
20
19
|
this.databaseId = options.databaseId;
|
|
21
20
|
this.urlPrefix = options.urlPrefix ?? (0, api_1.firestoreOriginOrEmulator)();
|
|
22
21
|
this.readBatchSize = 7500;
|
|
@@ -176,7 +175,7 @@ class FirestoreDelete {
|
|
|
176
175
|
return true;
|
|
177
176
|
}
|
|
178
177
|
if (failures.length > 0) {
|
|
179
|
-
logger_1.logger.debug(
|
|
178
|
+
logger_1.logger.debug(`Found ${failures.length} failed operations, failing.`);
|
|
180
179
|
return true;
|
|
181
180
|
}
|
|
182
181
|
if (queue.length <= this.maxQueueSize && pagesRemaining && !pageIncoming) {
|
|
@@ -193,7 +192,7 @@ class FirestoreDelete {
|
|
|
193
192
|
lastDocName = docs[docs.length - 1].name;
|
|
194
193
|
})
|
|
195
194
|
.catch((e) => {
|
|
196
|
-
logger_1.logger.debug(
|
|
195
|
+
logger_1.logger.debug(`Failed to fetch page after ${String(lastDocName)}`, e);
|
|
197
196
|
pageIncoming = false;
|
|
198
197
|
fetchFailures++;
|
|
199
198
|
if (fetchFailures >= 3) {
|
|
@@ -23,42 +23,45 @@ const WEBPACK_LAYERS_NAMES = {
|
|
|
23
23
|
reactServerComponents: "rsc",
|
|
24
24
|
serverSideRendering: "ssr",
|
|
25
25
|
actionBrowser: "action-browser",
|
|
26
|
-
|
|
27
|
-
apiEdge: "api-edge",
|
|
26
|
+
api: "api",
|
|
28
27
|
middleware: "middleware",
|
|
29
|
-
instrument: "instrument",
|
|
30
28
|
edgeAsset: "edge-asset",
|
|
31
29
|
appPagesBrowser: "app-pages-browser",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
pagesDirNode: "pages-dir-node",
|
|
30
|
+
appMetadataRoute: "app-metadata-route",
|
|
31
|
+
appRouteHandler: "app-route-handler",
|
|
35
32
|
};
|
|
36
33
|
exports.WEBPACK_LAYERS = {
|
|
37
34
|
...WEBPACK_LAYERS_NAMES,
|
|
35
|
+
pagesDirBrowser: "pages-dir-browser",
|
|
36
|
+
pagesDirEdge: "pages-dir-edge",
|
|
37
|
+
pagesDirNode: "pages-dir-node",
|
|
38
|
+
apiNode: "api-node",
|
|
39
|
+
apiEdge: "api-edge",
|
|
40
|
+
instrument: "instrument",
|
|
38
41
|
GROUP: {
|
|
39
42
|
builtinReact: [WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser],
|
|
40
43
|
serverOnly: [
|
|
44
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
41
45
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
42
46
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
43
|
-
|
|
44
|
-
WEBPACK_LAYERS_NAMES.middleware,
|
|
47
|
+
"instrument",
|
|
45
48
|
],
|
|
46
|
-
neutralTarget: [
|
|
49
|
+
neutralTarget: ["api-node", "api-edge"],
|
|
47
50
|
clientOnly: [WEBPACK_LAYERS_NAMES.serverSideRendering, WEBPACK_LAYERS_NAMES.appPagesBrowser],
|
|
48
51
|
bundled: [
|
|
52
|
+
WEBPACK_LAYERS_NAMES.shared,
|
|
53
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
49
54
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
50
|
-
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
51
55
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
56
|
+
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
57
|
+
"instrument",
|
|
52
58
|
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
53
|
-
WEBPACK_LAYERS_NAMES.shared,
|
|
54
|
-
WEBPACK_LAYERS_NAMES.instrument,
|
|
55
|
-
WEBPACK_LAYERS_NAMES.middleware,
|
|
56
59
|
],
|
|
57
60
|
appPages: [
|
|
58
61
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
59
62
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
60
|
-
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
61
63
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
64
|
+
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
62
65
|
],
|
|
63
66
|
},
|
|
64
67
|
};
|
|
@@ -16,6 +16,7 @@ const url_1 = require("url");
|
|
|
16
16
|
const semver_1 = require("semver");
|
|
17
17
|
const clc = require("colorette");
|
|
18
18
|
const fsutils_1 = require("../../fsutils");
|
|
19
|
+
const streamJson_1 = require("../../streamJson");
|
|
19
20
|
const prompt_1 = require("../../prompt");
|
|
20
21
|
const error_1 = require("../../error");
|
|
21
22
|
const utils_1 = require("../utils");
|
|
@@ -290,11 +291,11 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
|
290
291
|
{
|
|
291
292
|
srcRoute: null,
|
|
292
293
|
initialRevalidateSeconds: false,
|
|
293
|
-
initialExpireSeconds: undefined,
|
|
294
294
|
dataRoute: "",
|
|
295
295
|
experimentalPPR: false,
|
|
296
|
-
renderingMode: undefined,
|
|
297
296
|
prefetchDataRoute: "",
|
|
297
|
+
initialExpireSeconds: undefined,
|
|
298
|
+
renderingMode: undefined,
|
|
298
299
|
allowHeader: [],
|
|
299
300
|
},
|
|
300
301
|
];
|
|
@@ -394,7 +395,28 @@ async function ɵcodegenFunctionsDirectory(sourceDir, destDir, target, context)
|
|
|
394
395
|
if (!esbuild) {
|
|
395
396
|
throw new error_1.FirebaseError(`Failed to load esbuild from path: ${esbuildPath}`);
|
|
396
397
|
}
|
|
397
|
-
const
|
|
398
|
+
const { chain, parser, pick, streamObject } = await (0, streamJson_1.loadStreamJson)();
|
|
399
|
+
const productionDeps = await new Promise((resolve) => {
|
|
400
|
+
const dependencies = [];
|
|
401
|
+
const npmLs = (0, cross_spawn_1.spawn)("npm", ["ls", "--omit=dev", "--all", "--json=true"], {
|
|
402
|
+
cwd: sourceDir,
|
|
403
|
+
timeout: constants_1.NPM_COMMAND_TIMEOUT_MILLIES,
|
|
404
|
+
});
|
|
405
|
+
const pipeline = chain([
|
|
406
|
+
npmLs.stdout,
|
|
407
|
+
parser({ packValues: false, packKeys: true, streamValues: false }),
|
|
408
|
+
pick({ filter: "dependencies" }),
|
|
409
|
+
streamObject(),
|
|
410
|
+
({ key, value }) => [
|
|
411
|
+
key,
|
|
412
|
+
...(0, utils_2.allDependencyNames)(value),
|
|
413
|
+
],
|
|
414
|
+
]);
|
|
415
|
+
pipeline.on("data", (it) => dependencies.push(it));
|
|
416
|
+
pipeline.on("end", () => {
|
|
417
|
+
resolve([...new Set(dependencies)]);
|
|
418
|
+
});
|
|
419
|
+
});
|
|
398
420
|
const esbuildArgs = {
|
|
399
421
|
entryPoints: [(0, path_1.join)(sourceDir, configFile)],
|
|
400
422
|
outfile: (0, path_1.join)(destDir, configFile),
|
|
@@ -193,26 +193,24 @@ async function getProductionDependencyNames(sourceDir) {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
function getMiddlewareMatcherRegexes(middlewareManifest, functionsConfigManifest) {
|
|
196
|
-
const middlewareObjectValues = Object.values(middlewareManifest.middleware);
|
|
197
196
|
const middlewareMatchers = [];
|
|
198
197
|
if (middlewareManifest.version === 1) {
|
|
199
|
-
|
|
198
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
199
|
+
middlewareMatchers.push(...values.map((page) => ({
|
|
200
200
|
regexp: page.regexp,
|
|
201
201
|
})));
|
|
202
202
|
}
|
|
203
203
|
else if (middlewareManifest.version === 2) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
.flat());
|
|
204
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
205
|
+
middlewareMatchers.push(...values.map((page) => page.matchers || []).flat());
|
|
207
206
|
}
|
|
208
207
|
else if (middlewareManifest.version === 3) {
|
|
209
208
|
if (functionsConfigManifest?.functions?.["/_middleware"]) {
|
|
210
209
|
middlewareMatchers.push(...(functionsConfigManifest.functions["/_middleware"].matchers || []));
|
|
211
210
|
}
|
|
212
211
|
else {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
.flat());
|
|
212
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
213
|
+
middlewareMatchers.push(...values.map((page) => page.matchers || []).flat());
|
|
216
214
|
}
|
|
217
215
|
}
|
|
218
216
|
return middlewareMatchers.map((matcher) => new RegExp(matcher.regexp));
|
package/lib/gcp/cloudbilling.js
CHANGED
|
@@ -86,10 +86,10 @@ function logBillingStatus(enabled, projectId, featureName) {
|
|
|
86
86
|
async function openBillingAccount(projectId, url, open, featureName = "Extensions") {
|
|
87
87
|
if (open) {
|
|
88
88
|
try {
|
|
89
|
-
opn(url);
|
|
89
|
+
await opn(url);
|
|
90
90
|
}
|
|
91
91
|
catch (err) {
|
|
92
|
-
logger_1.logger.debug(
|
|
92
|
+
logger_1.logger.debug(`Unable to open billing URL: ${(0, error_1.getErrStack)(err)}`);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
const target = featureName === "Extensions" ? "your extension" : featureName.toLowerCase();
|