firebase-tools 15.34.2 → 15.36.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/api.js +2 -4
- package/lib/appcheck/debugTokens.js +293 -0
- package/lib/appcheck/localConfig.js +191 -0
- package/lib/appdistribution/options-parser-util.js +1 -1
- package/lib/apphosting/constants.js +1 -4
- package/lib/apphosting/githubConnections.js +1 -1
- package/lib/apphosting/utils.js +0 -26
- package/lib/auth.js +8 -2
- package/lib/commands/appcheck-debugtokens-create.js +60 -35
- package/lib/commands/appcheck-debugtokens-delete.js +21 -7
- package/lib/commands/appcheck-debugtokens-list.js +37 -8
- package/lib/commands/appcheck-debugtokens-prune.js +59 -0
- package/lib/commands/crashlytics-heapdumps-status.js +1 -1
- package/lib/commands/{crashlytics-onboard-web.js → crashlytics-setup.js} +5 -5
- package/lib/commands/crashlytics-sourcemap-upload.js +4 -0
- package/lib/commands/deploy.js +1 -3
- package/lib/commands/emulators-start.js +2 -2
- package/lib/commands/hosting-channel-create.js +1 -3
- package/lib/commands/hosting-channel-delete.js +1 -3
- package/lib/commands/hosting-channel-deploy.js +1 -3
- package/lib/commands/hosting-channel-list.js +1 -3
- package/lib/commands/hosting-channel-open.js +1 -3
- package/lib/commands/hosting-clone.js +3 -5
- package/lib/commands/hosting-disable.js +2 -2
- package/lib/commands/hosting-sites-create.js +1 -3
- package/lib/commands/hosting-sites-delete.js +1 -3
- package/lib/commands/hosting-sites-get.js +1 -3
- package/lib/commands/hosting-sites-list.js +1 -3
- package/lib/commands/index.js +4 -2
- package/lib/commands/run-services-get.js +19 -0
- package/lib/commands/run-services-list.js +11 -0
- package/lib/crashlytics/alerts.js +1 -0
- package/lib/crashlytics/events.js +122 -1
- package/lib/crashlytics/filters.js +12 -6
- package/lib/crashlytics/firebasetelemetry.js +5 -3
- package/lib/crashlytics/onboarding.js +8 -7
- package/lib/crashlytics/profilingManager.js +14 -34
- package/lib/crashlytics/reports.js +46 -17
- package/lib/crashlytics/sourcemap.js +19 -5
- package/lib/crashlytics/utils.js +14 -0
- package/lib/database/import.js +5 -4
- package/lib/dataconnect/dataplaneClient.js +0 -10
- package/lib/dataconnect/names.js +3 -3
- package/lib/dataconnect/schemaMigration.js +1 -1
- package/lib/deploy/apphosting/deploy.js +20 -41
- package/lib/deploy/apphosting/localBuild.js +49 -0
- package/lib/deploy/apphosting/prepare.js +12 -25
- package/lib/deploy/apphosting/release.js +1 -1
- package/lib/deploy/apphosting/util.js +27 -4
- package/lib/deploy/functions/backend.js +0 -10
- package/lib/deploy/functions/cel.js +1 -1
- package/lib/deploy/functions/containerCleaner.js +1 -142
- package/lib/deploy/functions/functionsDeployHelper.js +0 -4
- package/lib/deploy/functions/release/reporter.js +0 -26
- package/lib/deploy/functions/runtimes/discovery/index.js +4 -1
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +1 -1
- package/lib/deploy/functions/services/index.js +13 -11
- package/lib/deploy/functions/validate.js +1 -1
- package/lib/deploy/hosting/prepare.js +1 -3
- package/lib/deploy/lifecycleHooks.js +1 -1
- package/lib/deploy/run/deploy.js +26 -43
- package/lib/deploy/run/get.js +30 -0
- package/lib/deploy/run/list.js +38 -0
- package/lib/deploy/run/prereqs.js +0 -3
- package/lib/deploy/run/util.js +9 -0
- package/lib/emulator/auth/operations.js +2 -2
- package/lib/emulator/auth/server.js +4 -2
- package/lib/emulator/auth/widget_ui.js +1 -1
- package/lib/emulator/commandUtils.js +109 -24
- package/lib/emulator/databaseEmulator.js +16 -11
- package/lib/emulator/dataconnect/pgliteServer.js +31 -24
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/emulator/downloadableEmulators.js +45 -7
- package/lib/emulator/extensions/postinstall.js +6 -6
- package/lib/emulator/firestoreEmulator.js +21 -15
- package/lib/emulator/functionsEmulator.js +11 -7
- package/lib/emulator/functionsEmulatorRuntime.js +7 -2
- package/lib/emulator/hub.js +12 -8
- package/lib/emulator/shared/express.js +30 -0
- package/lib/emulator/storage/apis/firebase.js +11 -10
- package/lib/emulator/storage/apis/gcloud.js +21 -20
- package/lib/emulator/storage/files.js +1 -1
- package/lib/emulator/storage/rules/manager.js +15 -12
- package/lib/emulator/storage/rules/runtime.js +1 -0
- package/lib/emulator/storage/server.js +10 -5
- package/lib/extensions/extensionsApi.js +0 -8
- package/lib/extensions/extensionsHelper.js +3 -24
- package/lib/extensions/paramHelper.js +1 -1
- package/lib/extensions/provisioningHelper.js +1 -6
- package/lib/extensions/secretsUtils.js +0 -24
- package/lib/firestore/util.js +3 -3
- package/lib/frameworks/angular/utils.js +1 -1
- package/lib/frameworks/next/utils.js +1 -12
- package/lib/fsAsync.js +34 -20
- package/lib/functions/kits/install.js +233 -628
- package/lib/functions/kits/sources/directory.js +91 -0
- package/lib/functions/kits/sources/npm.js +324 -0
- package/lib/functions/kits/sources/types.js +12 -0
- package/lib/functionsConfig.js +0 -4
- package/lib/functionsShellCommandAction.js +1 -1
- package/lib/gcp/artifactregistry.js +0 -5
- package/lib/gcp/cloudfunctionsv2.js +0 -6
- package/lib/gcp/devConnect.js +2 -2
- package/lib/gcp/iam.js +0 -4
- package/lib/gcp/pubsub.js +0 -14
- package/lib/gcp/storage.js +2 -1
- package/lib/hosting/api.js +79 -0
- package/lib/hosting/proxy.js +4 -1
- package/lib/init/features/hosting/github.js +6 -4
- package/lib/init/features/hosting/index.js +4 -0
- package/lib/init/features/run.js +3 -7
- package/lib/mcp/apps/init/mcp-app.js +4 -1
- package/lib/mcp/index.js +8 -2
- package/lib/mcp/prompts/apptesting/run_test.js +3 -3
- package/lib/mcp/prompts/core/deploy.js +3 -3
- package/lib/mcp/resources/guides/crashlytics_reports.js +33 -71
- package/lib/mcp/resources/guides/init_ai.js +10 -10
- package/lib/mcp/tools/crashlytics/events.js +18 -93
- package/lib/mcp/tools/crashlytics/index.js +2 -0
- package/lib/mcp/tools/crashlytics/reports.js +26 -31
- package/lib/mcp/tools/crashlytics/setup.js +392 -0
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +4 -10
- package/package.json +1 -2
- package/lib/deploy/hosting/args.js +0 -2
|
@@ -9,7 +9,11 @@ exports.parseInspectionPort = parseInspectionPort;
|
|
|
9
9
|
exports.setExportOnExitOptions = setExportOnExitOptions;
|
|
10
10
|
exports.shutdownWhenKilled = shutdownWhenKilled;
|
|
11
11
|
exports.getListenOverview = getListenOverview;
|
|
12
|
+
exports.getListenSuffix = getListenSuffix;
|
|
12
13
|
exports.emulatorExec = emulatorExec;
|
|
14
|
+
exports.resetJavaBinaryForTesting = resetJavaBinaryForTesting;
|
|
15
|
+
exports.hasResolvedJavaBinary = hasResolvedJavaBinary;
|
|
16
|
+
exports.getJavaBinary = getJavaBinary;
|
|
13
17
|
exports.checkJavaMajorVersion = checkJavaMajorVersion;
|
|
14
18
|
const clc = require("colorette");
|
|
15
19
|
const childProcess = require("child_process");
|
|
@@ -164,7 +168,7 @@ function setExportOnExitOptions(options) {
|
|
|
164
168
|
function processKillSignal(signal, res, rej, options) {
|
|
165
169
|
let lastSignal = new Date().getTime();
|
|
166
170
|
let signalCount = 0;
|
|
167
|
-
|
|
171
|
+
const handleSignal = async () => {
|
|
168
172
|
try {
|
|
169
173
|
const now = new Date().getTime();
|
|
170
174
|
const diff = now - lastSignal;
|
|
@@ -217,6 +221,9 @@ function processKillSignal(signal, res, rej, options) {
|
|
|
217
221
|
rej((0, error_2.getError)(e));
|
|
218
222
|
}
|
|
219
223
|
};
|
|
224
|
+
return () => {
|
|
225
|
+
void handleSignal();
|
|
226
|
+
};
|
|
220
227
|
}
|
|
221
228
|
function shutdownWhenKilled(options) {
|
|
222
229
|
return new Promise((res, rej) => {
|
|
@@ -289,6 +296,14 @@ function getListenOverview(emulator) {
|
|
|
289
296
|
return `${info.host}:${info.port}`;
|
|
290
297
|
}
|
|
291
298
|
}
|
|
299
|
+
function getListenSuffix(emulator) {
|
|
300
|
+
const info = registry_1.EmulatorRegistry.get(emulator)?.getInfo();
|
|
301
|
+
const listen = getListenOverview(emulator);
|
|
302
|
+
if (!info || !listen || utils.connectableHostname(info.host) === info.host) {
|
|
303
|
+
return "";
|
|
304
|
+
}
|
|
305
|
+
return ` (listening on ${listen})`;
|
|
306
|
+
}
|
|
292
307
|
async function emulatorExec(script, options) {
|
|
293
308
|
const projectId = (0, projectUtils_1.getProjectId)(options);
|
|
294
309
|
const extraEnv = {};
|
|
@@ -325,13 +340,50 @@ async function emulatorExec(script, options) {
|
|
|
325
340
|
}
|
|
326
341
|
}
|
|
327
342
|
const JAVA_VERSION_REGEX = /version "([1-9][0-9]*)/;
|
|
343
|
+
const JAVA_HOME_REGEX = /^\s*java\.home\s*=\s*(.+)$/m;
|
|
328
344
|
const JAVA_HINT = "Please make sure Java is installed and on your system PATH.";
|
|
329
|
-
|
|
345
|
+
let resolvedJavaBinary;
|
|
346
|
+
function resetJavaBinaryForTesting() {
|
|
347
|
+
resolvedJavaBinary = undefined;
|
|
348
|
+
}
|
|
349
|
+
function hasResolvedJavaBinary() {
|
|
350
|
+
return Boolean(resolvedJavaBinary);
|
|
351
|
+
}
|
|
352
|
+
function getJavaFromJavaHome() {
|
|
353
|
+
const rawJavaHome = process.env.JAVA_HOME?.replace(/"/g, "").trim();
|
|
354
|
+
if (!rawJavaHome) {
|
|
355
|
+
return undefined;
|
|
356
|
+
}
|
|
357
|
+
const javaBinName = utils.IS_WINDOWS ? "java.exe" : "java";
|
|
358
|
+
const candidate = path.join(rawJavaHome, "bin", javaBinName);
|
|
359
|
+
return fsutils.fileExistsSync(candidate) ? candidate : undefined;
|
|
360
|
+
}
|
|
361
|
+
function getJavaBinary() {
|
|
362
|
+
if (!utils.IS_WINDOWS) {
|
|
363
|
+
return "java";
|
|
364
|
+
}
|
|
365
|
+
if (resolvedJavaBinary) {
|
|
366
|
+
return resolvedJavaBinary;
|
|
367
|
+
}
|
|
368
|
+
return getJavaFromJavaHome() || "java";
|
|
369
|
+
}
|
|
370
|
+
function spawnJavaVersionProcess(binary) {
|
|
371
|
+
const args = utils.IS_WINDOWS
|
|
372
|
+
? [
|
|
373
|
+
"-Duser.language=en",
|
|
374
|
+
"-Dfile.encoding=UTF-8",
|
|
375
|
+
"-Dstdout.encoding=UTF-8",
|
|
376
|
+
"-Dstderr.encoding=UTF-8",
|
|
377
|
+
"-XshowSettings:properties",
|
|
378
|
+
"-version",
|
|
379
|
+
]
|
|
380
|
+
: ["-Duser.language=en", "-Dfile.encoding=UTF-8", "-version"];
|
|
330
381
|
return new Promise((resolve, reject) => {
|
|
331
382
|
let child;
|
|
332
383
|
try {
|
|
333
|
-
child = childProcess.spawn(
|
|
334
|
-
stdio: ["
|
|
384
|
+
child = childProcess.spawn(binary, args, {
|
|
385
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
386
|
+
windowsHide: true,
|
|
335
387
|
});
|
|
336
388
|
}
|
|
337
389
|
catch (err) {
|
|
@@ -343,12 +395,16 @@ async function checkJavaMajorVersion() {
|
|
|
343
395
|
let error = "";
|
|
344
396
|
child.stdout?.on("data", (data) => {
|
|
345
397
|
const str = data.toString("utf8");
|
|
346
|
-
|
|
398
|
+
if (!utils.IS_WINDOWS) {
|
|
399
|
+
logger_1.logger.debug(str);
|
|
400
|
+
}
|
|
347
401
|
output += str;
|
|
348
402
|
});
|
|
349
403
|
child.stderr?.on("data", (data) => {
|
|
350
404
|
const str = data.toString("utf8");
|
|
351
|
-
|
|
405
|
+
if (!utils.IS_WINDOWS) {
|
|
406
|
+
logger_1.logger.debug(str);
|
|
407
|
+
}
|
|
352
408
|
error += str;
|
|
353
409
|
});
|
|
354
410
|
child.once("error", (err) => {
|
|
@@ -367,29 +423,58 @@ async function checkJavaMajorVersion() {
|
|
|
367
423
|
resolve(`${output}\n${error}`);
|
|
368
424
|
}
|
|
369
425
|
});
|
|
370
|
-
})
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
async function checkJavaMajorVersion() {
|
|
429
|
+
let output;
|
|
430
|
+
try {
|
|
431
|
+
output = await spawnJavaVersionProcess("java");
|
|
432
|
+
}
|
|
433
|
+
catch (err) {
|
|
434
|
+
const javaHomeBin = utils.IS_WINDOWS ? getJavaFromJavaHome() : undefined;
|
|
435
|
+
if (!javaHomeBin) {
|
|
436
|
+
throw err;
|
|
437
|
+
}
|
|
438
|
+
output = await spawnJavaVersionProcess(javaHomeBin);
|
|
439
|
+
}
|
|
440
|
+
if (utils.IS_WINDOWS) {
|
|
441
|
+
const javaHomeMatch = JAVA_HOME_REGEX.exec(output);
|
|
442
|
+
if (javaHomeMatch) {
|
|
443
|
+
const javaHome = javaHomeMatch[1].trim();
|
|
444
|
+
const candidate = path.join(javaHome, "bin", "java.exe");
|
|
445
|
+
if (fsutils.fileExistsSync(candidate)) {
|
|
446
|
+
resolvedJavaBinary = candidate;
|
|
447
|
+
logger_1.logger.debug(`Resolved Java binary from java.home: ${resolvedJavaBinary}`);
|
|
381
448
|
}
|
|
382
449
|
}
|
|
383
450
|
else {
|
|
384
|
-
|
|
385
|
-
|
|
451
|
+
const fallback = getJavaFromJavaHome();
|
|
452
|
+
if (fallback) {
|
|
453
|
+
resolvedJavaBinary = fallback;
|
|
454
|
+
}
|
|
386
455
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
456
|
+
}
|
|
457
|
+
let versionInt = -1;
|
|
458
|
+
const match = JAVA_VERSION_REGEX.exec(output);
|
|
459
|
+
if (match) {
|
|
460
|
+
const version = match[1];
|
|
461
|
+
versionInt = parseInt(version, 10);
|
|
462
|
+
if (!versionInt) {
|
|
463
|
+
utils.logLabeledWarning("emulators", `Failed to parse Java version. Got "${match[0]}".`, "warn");
|
|
390
464
|
}
|
|
391
|
-
|
|
392
|
-
|
|
465
|
+
else {
|
|
466
|
+
logger_1.logger.debug(`Parsed Java major version: ${versionInt}`);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
logger_1.logger.debug("java -version outputs:", output);
|
|
471
|
+
logger_1.logger.warn(`Failed to parse Java version.`);
|
|
472
|
+
}
|
|
473
|
+
const session = (0, track_1.emulatorSession)();
|
|
474
|
+
if (session) {
|
|
475
|
+
session.javaMajorVersion = versionInt;
|
|
476
|
+
}
|
|
477
|
+
return versionInt;
|
|
393
478
|
}
|
|
394
479
|
exports.MIN_SUPPORTED_JAVA_MAJOR_VERSION = 21;
|
|
395
480
|
exports.JAVA_DEPRECATION_WARNING = "firebase-tools no longer supports Java version before 21. " +
|
|
@@ -35,17 +35,22 @@ class DatabaseEmulator {
|
|
|
35
35
|
}
|
|
36
36
|
const watcher = chokidar.watch(c.rules, { persistent: true, ignoreInitial: true });
|
|
37
37
|
this.rulesWatchers.push(watcher);
|
|
38
|
-
watcher.on("change",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
watcher.on("change", () => {
|
|
39
|
+
const update = async () => {
|
|
40
|
+
await new Promise((res) => setTimeout(res, 5));
|
|
41
|
+
this.logger.logLabeled("BULLET", "database", `Change detected, updating rules for ${c.instance}...`);
|
|
42
|
+
try {
|
|
43
|
+
await this.updateRules(c.instance, c.rules);
|
|
44
|
+
this.logger.logLabeled("SUCCESS", "database", "Rules updated.");
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
this.logger.logLabeled("WARN", "database", this.prettyPrintRulesError(c.rules, e));
|
|
48
|
+
this.logger.logLabeled("WARN", "database", "Failed to update rules");
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
update().catch((err) => {
|
|
52
|
+
this.logger.logLabeled("WARN", "database", `Failed to update rules: ${(0, error_1.getErrMsg)(err)}`);
|
|
53
|
+
});
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -29,30 +29,36 @@ const decoder = new node_string_decoder_1.StringDecoder();
|
|
|
29
29
|
class PostgresServer {
|
|
30
30
|
async createPGServer(host = "127.0.0.1", port) {
|
|
31
31
|
const getDb = this.getDb.bind(this);
|
|
32
|
-
const server = net.createServer(
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
const server = net.createServer((socket) => {
|
|
33
|
+
const handleConnection = async () => {
|
|
34
|
+
const connection = await fromNodeSocket(socket, {
|
|
35
|
+
serverVersion: "17.4 (PGlite 0.3.3)",
|
|
36
|
+
auth: { method: "trust" },
|
|
37
|
+
async *onMessage(data, { isAuthenticated }) {
|
|
38
|
+
if (!isAuthenticated) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const db = await getDb();
|
|
42
|
+
if (data[0] === pg_gateway_1.FrontendMessageCode.Terminate) {
|
|
43
|
+
await db.query("DEALLOCATE ALL");
|
|
44
|
+
}
|
|
45
|
+
const response = await db.execProtocolRaw(data);
|
|
46
|
+
for await (const message of extendedQueryPatch.getMessages(data, response)) {
|
|
47
|
+
yield message;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const extendedQueryPatch = new PGliteLoggerPatch(connection);
|
|
52
|
+
socket.on("end", () => {
|
|
53
|
+
logger_1.logger.debug("Postgres client disconnected");
|
|
54
|
+
});
|
|
55
|
+
socket.on("error", (err) => {
|
|
56
|
+
logger_1.logger.debug("Postgres client socket error (if this happened during request cancellation, it is expected and harmless):", err);
|
|
57
|
+
socket.destroy();
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
handleConnection().catch((err) => {
|
|
61
|
+
logger_1.logger.debug("Postgres client connection setup failed:", err);
|
|
56
62
|
socket.destroy();
|
|
57
63
|
});
|
|
58
64
|
});
|
|
@@ -194,6 +200,7 @@ class PostgresServer {
|
|
|
194
200
|
}
|
|
195
201
|
exports.PostgresServer = PostgresServer;
|
|
196
202
|
async function fromNodeSocket(socket, options) {
|
|
203
|
+
socket.setNoDelay(true);
|
|
197
204
|
const rs = node_stream_1.Readable.toWeb(socket);
|
|
198
205
|
const ws = node_stream_1.Writable.toWeb(socket);
|
|
199
206
|
const opts = options
|
|
@@ -54,36 +54,36 @@
|
|
|
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.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"
|
|
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.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"
|
|
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.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"
|
|
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.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"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -25,6 +25,7 @@ const path = require("path");
|
|
|
25
25
|
const os = require("os");
|
|
26
26
|
const registry_1 = require("./registry");
|
|
27
27
|
const download_1 = require("../emulator/download");
|
|
28
|
+
const commandUtils_1 = require("./commandUtils");
|
|
28
29
|
const experiments = require("../experiments");
|
|
29
30
|
const process = require("process");
|
|
30
31
|
const emulatorUpdateDetails = require("./downloadableEmulatorInfo.json");
|
|
@@ -252,6 +253,14 @@ function getExecPath(name) {
|
|
|
252
253
|
const details = getDownloadDetails(name);
|
|
253
254
|
return details.binaryPath || details.downloadPath;
|
|
254
255
|
}
|
|
256
|
+
function getPubsubJarPath() {
|
|
257
|
+
const details = getDownloadDetails(types_1.Emulators.PUBSUB);
|
|
258
|
+
return path.join(details.unzipDir || "", "pubsub-emulator", "lib", `cloud-pubsub-emulator-${details.version}-all.jar`);
|
|
259
|
+
}
|
|
260
|
+
function splitEnvOpts(value) {
|
|
261
|
+
const trimmed = value?.trim();
|
|
262
|
+
return trimmed ? trimmed.split(/\s+/) : [];
|
|
263
|
+
}
|
|
255
264
|
function getLogFileName(name) {
|
|
256
265
|
return `${name}-debug.log`;
|
|
257
266
|
}
|
|
@@ -261,7 +270,16 @@ function _getCommand(emulator, args) {
|
|
|
261
270
|
if (!args.port) {
|
|
262
271
|
args.port = defaultPort;
|
|
263
272
|
}
|
|
264
|
-
const
|
|
273
|
+
const useDirectPubsubJarOnWindows = emulator === types_1.Emulators.PUBSUB && utils.IS_WINDOWS && !process.env.PUBSUB_EMULATOR_BINARY_PATH;
|
|
274
|
+
const cmdLineArgs = useDirectPubsubJarOnWindows
|
|
275
|
+
? [
|
|
276
|
+
"-Duser.language=en",
|
|
277
|
+
...splitEnvOpts(process.env.JAVA_OPTS),
|
|
278
|
+
...splitEnvOpts(process.env.CLOUD_PUBSUB_EMULATOR_OPTS),
|
|
279
|
+
"-jar",
|
|
280
|
+
getPubsubJarPath(),
|
|
281
|
+
]
|
|
282
|
+
: baseCmd.args.slice();
|
|
265
283
|
if (baseCmd.binary === "java" &&
|
|
266
284
|
utils.isRunningInWSL() &&
|
|
267
285
|
(!args.host || !args.host.includes(":"))) {
|
|
@@ -286,12 +304,19 @@ function _getCommand(emulator, args) {
|
|
|
286
304
|
cmdLineArgs.push(argKey, argVal);
|
|
287
305
|
}
|
|
288
306
|
});
|
|
307
|
+
let binary = baseCmd.binary;
|
|
308
|
+
if (baseCmd.binary === "java" || useDirectPubsubJarOnWindows) {
|
|
309
|
+
binary = (0, commandUtils_1.getJavaBinary)();
|
|
310
|
+
}
|
|
311
|
+
else if (emulator === types_1.Emulators.PUBSUB && process.env.PUBSUB_EMULATOR_BINARY_PATH) {
|
|
312
|
+
binary = getExecPath(types_1.Emulators.PUBSUB);
|
|
313
|
+
}
|
|
289
314
|
return {
|
|
290
|
-
binary
|
|
315
|
+
binary,
|
|
291
316
|
args: cmdLineArgs,
|
|
292
317
|
optionalArgs: baseCmd.optionalArgs,
|
|
293
318
|
joinArgs: baseCmd.joinArgs,
|
|
294
|
-
shell: baseCmd.shell,
|
|
319
|
+
shell: useDirectPubsubJarOnWindows ? false : baseCmd.shell,
|
|
295
320
|
port: args.port,
|
|
296
321
|
};
|
|
297
322
|
}
|
|
@@ -307,7 +332,12 @@ async function _fatal(emulator, errorMsg) {
|
|
|
307
332
|
}
|
|
308
333
|
async function handleEmulatorProcessError(emulator, err, port) {
|
|
309
334
|
const description = constants_1.Constants.description(emulator);
|
|
310
|
-
|
|
335
|
+
const isJavaBinaryError = err.path === "java" ||
|
|
336
|
+
path
|
|
337
|
+
.basename(String(err.path || ""))
|
|
338
|
+
.replace(/\.exe$/i, "")
|
|
339
|
+
.toLowerCase() === "java";
|
|
340
|
+
if (isJavaBinaryError && err.code === "ENOENT") {
|
|
311
341
|
await _fatal(emulator, `${description} has exited because java is not installed, you can install it from https://openjdk.java.net/install/`);
|
|
312
342
|
}
|
|
313
343
|
else if (err.code === "EADDRINUSE") {
|
|
@@ -332,7 +362,7 @@ async function _runBinary(emulator, command, extraEnv) {
|
|
|
332
362
|
const opts = {
|
|
333
363
|
env: { ...process.env, ...extraEnv },
|
|
334
364
|
detached: true,
|
|
335
|
-
stdio: ["
|
|
365
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
336
366
|
};
|
|
337
367
|
if (command.shell && utils.IS_WINDOWS) {
|
|
338
368
|
opts.shell = true;
|
|
@@ -377,12 +407,12 @@ async function _runBinary(emulator, command, extraEnv) {
|
|
|
377
407
|
emulator.instance.on("error", (err) => {
|
|
378
408
|
void handleEmulatorProcessError(emulator.name, err, command.port);
|
|
379
409
|
});
|
|
380
|
-
emulator.instance.once("exit",
|
|
410
|
+
emulator.instance.once("exit", (code, signal) => {
|
|
381
411
|
if (signal) {
|
|
382
412
|
utils.logWarning(`${description} has exited upon receiving signal: ${signal}`);
|
|
383
413
|
}
|
|
384
414
|
else if (code && code !== 0 && code !== 130) {
|
|
385
|
-
|
|
415
|
+
void _fatal(emulator.name, `${description} has exited with code: ${code}`);
|
|
386
416
|
}
|
|
387
417
|
});
|
|
388
418
|
resolve();
|
|
@@ -454,6 +484,14 @@ async function start(targetName, args, extraEnv = {}) {
|
|
|
454
484
|
throw new error_1.FirebaseError("emulator not found");
|
|
455
485
|
}
|
|
456
486
|
}
|
|
487
|
+
if (targetName === types_1.Emulators.PUBSUB &&
|
|
488
|
+
utils.IS_WINDOWS &&
|
|
489
|
+
!process.env.PUBSUB_EMULATOR_BINARY_PATH &&
|
|
490
|
+
!(0, commandUtils_1.hasResolvedJavaBinary)()) {
|
|
491
|
+
await (0, commandUtils_1.checkJavaMajorVersion)().catch((err) => {
|
|
492
|
+
logger.log("DEBUG", `Failed to resolve Java binary for Pub/Sub emulator: ${String(err)}`);
|
|
493
|
+
});
|
|
494
|
+
}
|
|
457
495
|
const command = _getCommand(targetName, args);
|
|
458
496
|
logger.log("DEBUG", `Starting ${constants_1.Constants.description(targetName)} with command ${JSON.stringify(command)}`);
|
|
459
497
|
return _runBinary(emulator, command, extraEnv);
|
|
@@ -9,27 +9,27 @@ function replaceConsoleLinks(postinstall) {
|
|
|
9
9
|
let subbedPostinstall = postinstall;
|
|
10
10
|
const linkReplacements = new Map([
|
|
11
11
|
[
|
|
12
|
-
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/storage[A-Za-z0-9
|
|
12
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/storage[A-Za-z0-9/-]*(?=[)\]\s])/,
|
|
13
13
|
`${uiUrl}${types_1.Emulators.STORAGE}`,
|
|
14
14
|
],
|
|
15
15
|
[
|
|
16
|
-
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/firestore[A-Za-z0-9
|
|
16
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/firestore[A-Za-z0-9/-]*(?=[)\]\s])/,
|
|
17
17
|
`${uiUrl}${types_1.Emulators.FIRESTORE}`,
|
|
18
18
|
],
|
|
19
19
|
[
|
|
20
|
-
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/database[A-Za-z0-9
|
|
20
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/database[A-Za-z0-9/-]*(?=[)\]\s])/,
|
|
21
21
|
`${uiUrl}${types_1.Emulators.DATABASE}`,
|
|
22
22
|
],
|
|
23
23
|
[
|
|
24
|
-
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/authentication[A-Za-z0-9
|
|
24
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/authentication[A-Za-z0-9/-]*(?=[)\]\s])/,
|
|
25
25
|
`${uiUrl}${types_1.Emulators.AUTH}`,
|
|
26
26
|
],
|
|
27
27
|
[
|
|
28
|
-
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/functions[A-Za-z0-9
|
|
28
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/functions[A-Za-z0-9/-]*(?=[)\]\s])/,
|
|
29
29
|
`${uiUrl}logs`,
|
|
30
30
|
],
|
|
31
31
|
[
|
|
32
|
-
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/extensions[A-Za-z0-9
|
|
32
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/extensions[A-Za-z0-9/-]*(?=[)\]\s])/,
|
|
33
33
|
`${uiUrl}${types_1.Emulators.EXTENSIONS}`,
|
|
34
34
|
],
|
|
35
35
|
]);
|
|
@@ -6,6 +6,7 @@ const fs = require("fs");
|
|
|
6
6
|
const clc = require("colorette");
|
|
7
7
|
const path = require("path");
|
|
8
8
|
const utils = require("../utils");
|
|
9
|
+
const error_1 = require("../error");
|
|
9
10
|
const downloadableEmulators = require("./downloadableEmulators");
|
|
10
11
|
const types_1 = require("../emulator/types");
|
|
11
12
|
const registry_1 = require("./registry");
|
|
@@ -26,22 +27,27 @@ class FirestoreEmulator {
|
|
|
26
27
|
utils.logLabeledWarning("firestore", `Could not watch ${rulesPath} for changes, so rules hot reloading is disabled: ${message}. ` +
|
|
27
28
|
"If your environment does not support file watching, set CHOKIDAR_USEPOLLING=1 to fall back to polling.");
|
|
28
29
|
});
|
|
29
|
-
this.rulesWatcher.on("change",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
this.rulesWatcher.on("change", () => {
|
|
31
|
+
const update = async () => {
|
|
32
|
+
await new Promise((res) => setTimeout(res, 5));
|
|
33
|
+
utils.logLabeledBullet("firestore", "Change detected, updating rules...");
|
|
34
|
+
const newContent = fs.readFileSync(rulesPath, "utf8").toString();
|
|
35
|
+
const issues = await this.updateRules(newContent);
|
|
36
|
+
if (issues) {
|
|
37
|
+
for (const issue of issues) {
|
|
38
|
+
utils.logWarning(this.prettyPrintRulesIssue(rulesPath, issue));
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
41
|
+
if (issues.some((issue) => issue.severity === types_1.Severity.ERROR)) {
|
|
42
|
+
utils.logWarning("Failed to update rules");
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
utils.logLabeledSuccess("firestore", "Rules updated.");
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
update().catch((err) => {
|
|
49
|
+
utils.logWarning(`Failed to update rules: ${(0, error_1.getErrMsg)(err)}`);
|
|
50
|
+
});
|
|
45
51
|
});
|
|
46
52
|
}
|
|
47
53
|
return downloadableEmulators.start(types_1.Emulators.FIRESTORE, this.args);
|
|
@@ -68,10 +68,10 @@ class TCPConn {
|
|
|
68
68
|
exports.TCPConn = TCPConn;
|
|
69
69
|
function createIgnoredFilter(ignore) {
|
|
70
70
|
const ignored = [
|
|
71
|
-
/(^|[
|
|
71
|
+
/(^|[/\\])\../,
|
|
72
72
|
/.+\.log/,
|
|
73
|
-
/.+?[
|
|
74
|
-
/.+?[
|
|
73
|
+
/.+?[\\/]node_modules[\\/].+?/,
|
|
74
|
+
/.+?[\\/]venv[\\/].+?/,
|
|
75
75
|
];
|
|
76
76
|
if (ignore) {
|
|
77
77
|
const minimatchInstances = ignore.map((pattern) => {
|
|
@@ -309,7 +309,9 @@ class FunctionsEmulator {
|
|
|
309
309
|
};
|
|
310
310
|
const delegate = await runtimes.getRuntimeDelegate(runtimeDelegateContext);
|
|
311
311
|
this.logger.logLabeled("BULLET", "functions", `Starting build_runner watch for Dart functions...`);
|
|
312
|
-
const debouncedLoadTriggers = (0, utils_1.debounce)(() =>
|
|
312
|
+
const debouncedLoadTriggers = (0, utils_1.debounce)(() => {
|
|
313
|
+
this.loadTriggers(backend).catch((err) => this.logger.logLabeled("WARN", "functions", `Failed to reload triggers: ${(0, error_1.getErrMsg)(err)}`));
|
|
314
|
+
}, 1000);
|
|
313
315
|
const cleanup = await delegate.watch(() => {
|
|
314
316
|
this.logger.log("DEBUG", "build_runner rebuilt, reloading triggers");
|
|
315
317
|
debouncedLoadTriggers();
|
|
@@ -323,10 +325,12 @@ class FunctionsEmulator {
|
|
|
323
325
|
persistent: true,
|
|
324
326
|
});
|
|
325
327
|
this.watchers.push(watcher);
|
|
326
|
-
const debouncedLoadTriggers = (0, utils_1.debounce)(() =>
|
|
328
|
+
const debouncedLoadTriggers = (0, utils_1.debounce)(() => {
|
|
329
|
+
this.loadTriggers(backend).catch((err) => this.logger.logLabeled("WARN", "functions", `Failed to reload triggers: ${(0, error_1.getErrMsg)(err)}`));
|
|
330
|
+
}, 1000);
|
|
327
331
|
watcher.on("change", (filePath) => {
|
|
328
332
|
this.logger.log("DEBUG", `File ${filePath} changed, reloading triggers`);
|
|
329
|
-
|
|
333
|
+
debouncedLoadTriggers();
|
|
330
334
|
});
|
|
331
335
|
}
|
|
332
336
|
}
|
|
@@ -1290,7 +1294,7 @@ class FunctionsEmulator {
|
|
|
1290
1294
|
});
|
|
1291
1295
|
this.logger.log("DEBUG", `[functions] Runtime ready! Sending request!`);
|
|
1292
1296
|
const url = new url_1.URL(`${req.protocol}://${req.hostname}${req.url}`);
|
|
1293
|
-
let path = `${url.pathname}${url.search}`.replace(new RegExp(
|
|
1297
|
+
let path = `${url.pathname}${url.search}`.replace(new RegExp(`/${this.args.projectId}/[^/]*/${req.params.trigger_name}/?`), "/");
|
|
1294
1298
|
if ((0, supported_1.runtimeIsLanguage)(record.backend.runtime, "dart")) {
|
|
1295
1299
|
const isBackgroundRoute = req.url.startsWith("/functions/projects/");
|
|
1296
1300
|
if (isBackgroundRoute || path === "/") {
|
|
@@ -565,7 +565,7 @@ async function main() {
|
|
|
565
565
|
app.all("/favicon.ico|/robots.txt", (req, res) => {
|
|
566
566
|
res.status(404).send();
|
|
567
567
|
});
|
|
568
|
-
|
|
568
|
+
async function handleRequest(req, res) {
|
|
569
569
|
try {
|
|
570
570
|
const trigger = FUNCTION_TARGET_NAME.split(".").reduce((mod, functionTargetPart) => {
|
|
571
571
|
return mod?.[functionTargetPart];
|
|
@@ -595,8 +595,13 @@ async function main() {
|
|
|
595
595
|
}
|
|
596
596
|
catch (err) {
|
|
597
597
|
new types_1.EmulatorLog("FATAL", "runtime-error", (0, error_1.getErrStack)(err)).log();
|
|
598
|
-
res.
|
|
598
|
+
if (!res.headersSent) {
|
|
599
|
+
res.status(500).send((0, error_1.getErrMsg)(err));
|
|
600
|
+
}
|
|
599
601
|
}
|
|
602
|
+
}
|
|
603
|
+
app.all(`/*`, (req, res) => {
|
|
604
|
+
void handleRequest(req, res);
|
|
600
605
|
});
|
|
601
606
|
app.listen(process.env.PORT, () => {
|
|
602
607
|
logDebug(`Listening to port: ${process.env.PORT}`);
|