firebase-tools-with-isolate 15.37.0 → 15.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accountImporter.js +8 -4
- package/lib/apiv2.js +66 -11
- package/lib/appUtils.js +103 -40
- package/lib/appdistribution/client.js +5 -1
- package/lib/commands/appdistribution-distribute.js +5 -3
- package/lib/commands/crashlytics-events-get.js +1 -3
- package/lib/commands/crashlytics-events-list.js +1 -3
- package/lib/commands/crashlytics-issues-get.js +7 -3
- package/lib/commands/crashlytics-reports-get.js +103 -15
- package/lib/crashlytics/commandUtils.js +39 -6
- package/lib/crashlytics/events.js +63 -65
- package/lib/deploy/firestore/prepare.js +2 -14
- package/lib/deploy/functions/runtimes/python/index.js +3 -0
- package/lib/deploy/functions/runtimes/supported/types.js +6 -0
- package/lib/deploy/run/deploy.js +40 -35
- package/lib/deploy/run/prereqs.js +0 -3
- package/lib/downloadUtils.js +2 -1
- package/lib/emulator/download.js +1 -0
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/emulator/downloadableEmulators.js +14 -2
- package/lib/emulator/events/types.js +0 -6
- package/lib/emulator/storage/cloudFunctions.js +0 -1
- package/lib/emulator/storage/rules/runtime.js +0 -3
- package/lib/emulator/taskQueue.js +0 -12
- package/lib/experiments.js +5 -0
- package/lib/extensions/extensionsHelper.js +1 -4
- package/lib/extensions/replacements.json +2 -1
- package/lib/firestore/fsConfig.js +100 -41
- package/lib/frameworks/next/index.js +1 -23
- package/lib/gcp/runv2.js +0 -27
- package/lib/gcp/secretManager.js +2 -2
- package/lib/hosting/api.js +29 -16
- package/lib/init/features/dataconnect/sdk.js +15 -5
- package/lib/management/apps.js +7 -0
- package/lib/mcp/index.js +4 -2
- package/lib/mcp/tools/core/get_environment.js +1 -1
- package/lib/mcp/tools/crashlytics/events.js +2 -5
- package/lib/mcp/tools/crashlytics/reports.js +3 -12
- package/lib/mcp/util/apptesting/availability.js +3 -2
- package/lib/mcp/util/crashlytics/availability.js +59 -12
- package/lib/mcp/util.js +4 -0
- package/lib/requireAuth.js +11 -7
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/schema/firebase-config.json +6 -3
- package/standalone/package.json +6 -1
|
@@ -11,6 +11,7 @@ const requireAuth_1 = require("../requireAuth");
|
|
|
11
11
|
const DEFAULT_LIMIT = 10;
|
|
12
12
|
const MAX_LIMIT = 100;
|
|
13
13
|
const MAX_CELL_LENGTH = 60;
|
|
14
|
+
const MAX_SUBGROUPS_PER_GROUP = 100;
|
|
14
15
|
exports.REPORTS_REQUIRING_ISSUE_ID = [
|
|
15
16
|
"topVariants",
|
|
16
17
|
"topBrowsers",
|
|
@@ -25,24 +26,47 @@ const METRIC_COLUMNS = [
|
|
|
25
26
|
{ header: "Crash-Free Users", value: (m) => m.crashFreeUsersPercentage, percent: true },
|
|
26
27
|
{ header: "Crash-Free Sessions", value: (m) => m.crashFreeSessionsPercentage, percent: true },
|
|
27
28
|
];
|
|
29
|
+
const DEVICE_CATEGORY_LABELS = {
|
|
30
|
+
CATEGORY_MOBILE: "Mobile",
|
|
31
|
+
CATEGORY_TABLET: "Tablet",
|
|
32
|
+
CATEGORY_DESKTOP: "Desktop",
|
|
33
|
+
CATEGORY_TV: "TV",
|
|
34
|
+
CATEGORY_WEARABLE: "Wearable",
|
|
35
|
+
CATEGORY_UNKNOWN: "Unknown",
|
|
36
|
+
CATEGORY_UNSPECIFIED: "Unspecified",
|
|
37
|
+
};
|
|
28
38
|
function truncate(value, max = MAX_CELL_LENGTH) {
|
|
29
39
|
if (!value) {
|
|
30
40
|
return "";
|
|
31
41
|
}
|
|
32
42
|
return value.length > max ? `${value.slice(0, max - 1)}…` : value;
|
|
33
43
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
44
|
+
function formatDeviceCategory(deviceType) {
|
|
45
|
+
if (!deviceType) {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
const mapped = DEVICE_CATEGORY_LABELS[deviceType];
|
|
49
|
+
if (mapped) {
|
|
50
|
+
return mapped;
|
|
51
|
+
}
|
|
52
|
+
const normalized = deviceType.replace(/^CATEGORY_/i, "").toLowerCase();
|
|
53
|
+
return normalized ? `${normalized[0].toUpperCase()}${normalized.slice(1)}` : deviceType;
|
|
54
|
+
}
|
|
55
|
+
function isDeviceCategoryDimension(sampleGroups) {
|
|
56
|
+
return (sampleGroups.some((g) => g.operatingSystem?.deviceType) &&
|
|
57
|
+
!sampleGroups.some((g) => g.operatingSystem?.displayName || g.operatingSystem?.os));
|
|
36
58
|
}
|
|
37
|
-
function dimensionFor(
|
|
59
|
+
function dimensionFor(sampleGroups) {
|
|
60
|
+
const group = sampleGroups[0];
|
|
38
61
|
if (group?.issue) {
|
|
62
|
+
const showErrorType = sampleGroups.some((g) => !!g.issue?.errorType);
|
|
39
63
|
return {
|
|
40
|
-
headers: ["Issue ID", "Title", "Error Type", "Sample Event"],
|
|
64
|
+
headers: ["Issue ID", "Title", ...(showErrorType ? ["Error Type"] : []), "Sample Event"],
|
|
41
65
|
cells: (g) => [
|
|
42
66
|
g.issue?.id || "",
|
|
43
67
|
truncate(g.issue?.title),
|
|
44
|
-
g.issue?.errorType || "",
|
|
45
|
-
shortEventId(g.issue?.sampleEvent),
|
|
68
|
+
...(showErrorType ? [g.issue?.errorType || ""] : []),
|
|
69
|
+
(0, commandUtils_1.shortEventId)(g.issue?.sampleEvent),
|
|
46
70
|
],
|
|
47
71
|
hasSampleEvents: true,
|
|
48
72
|
};
|
|
@@ -50,7 +74,7 @@ function dimensionFor(group) {
|
|
|
50
74
|
if (group?.variant) {
|
|
51
75
|
return {
|
|
52
76
|
headers: ["Variant ID", "Sample Event"],
|
|
53
|
-
cells: (g) => [g.variant?.id || "", shortEventId(g.variant?.sampleEvent)],
|
|
77
|
+
cells: (g) => [g.variant?.id || "", (0, commandUtils_1.shortEventId)(g.variant?.sampleEvent)],
|
|
54
78
|
hasSampleEvents: true,
|
|
55
79
|
};
|
|
56
80
|
}
|
|
@@ -65,10 +89,40 @@ function dimensionFor(group) {
|
|
|
65
89
|
};
|
|
66
90
|
}
|
|
67
91
|
if (group?.operatingSystem) {
|
|
68
|
-
|
|
92
|
+
if (isDeviceCategoryDimension(sampleGroups)) {
|
|
93
|
+
return {
|
|
94
|
+
headers: ["Device Category"],
|
|
95
|
+
cells: (g) => [formatDeviceCategory(g.operatingSystem?.deviceType)],
|
|
96
|
+
noun: "category",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
headers: ["Operating System"],
|
|
101
|
+
cells: (g) => [
|
|
102
|
+
g.operatingSystem?.displayName ||
|
|
103
|
+
g.operatingSystem?.os ||
|
|
104
|
+
g.operatingSystem?.type ||
|
|
105
|
+
formatDeviceCategory(g.operatingSystem?.deviceType),
|
|
106
|
+
],
|
|
107
|
+
};
|
|
69
108
|
}
|
|
70
109
|
if (group?.device) {
|
|
71
|
-
|
|
110
|
+
const hasMarketingName = sampleGroups.some((g) => g.device?.marketingName);
|
|
111
|
+
if (hasMarketingName) {
|
|
112
|
+
return {
|
|
113
|
+
headers: ["Device", "Marketing Name"],
|
|
114
|
+
cells: (g) => [
|
|
115
|
+
g.device?.displayName || g.device?.model || "-",
|
|
116
|
+
truncate(g.device?.marketingName) || "-",
|
|
117
|
+
],
|
|
118
|
+
noun: "devices",
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
headers: ["Device"],
|
|
123
|
+
cells: (g) => [g.device?.displayName || g.device?.model || ""],
|
|
124
|
+
noun: "devices",
|
|
125
|
+
};
|
|
72
126
|
}
|
|
73
127
|
if (group?.browser) {
|
|
74
128
|
return { headers: ["Browser"], cells: (g) => [g.browser?.displayName || ""] };
|
|
@@ -93,16 +147,46 @@ function formatMetric(column, metrics) {
|
|
|
93
147
|
}
|
|
94
148
|
function logReport(report, appId, limit) {
|
|
95
149
|
const groups = report.groups || [];
|
|
96
|
-
const
|
|
150
|
+
const parentDimension = dimensionFor(groups);
|
|
151
|
+
const allSubgroups = groups.flatMap((g) => g.subgroups || []);
|
|
152
|
+
const subgroupDimension = allSubgroups.length > 0 ? dimensionFor(allSubgroups) : undefined;
|
|
153
|
+
const shownSubgroups = groups.map((g) => (g.subgroups || []).slice(0, limit));
|
|
154
|
+
const renderedMetricGroups = subgroupDimension
|
|
155
|
+
? groups.flatMap((g, i) => (shownSubgroups[i].length ? shownSubgroups[i] : [g]))
|
|
156
|
+
: groups;
|
|
97
157
|
const metricColumns = METRIC_COLUMNS.filter((col) => col.always ||
|
|
98
|
-
|
|
158
|
+
renderedMetricGroups.some((g) => g.metrics?.[0] !== undefined && col.value(g.metrics[0]) !== undefined));
|
|
99
159
|
const table = new Table({
|
|
100
|
-
head: [
|
|
160
|
+
head: [
|
|
161
|
+
...parentDimension.headers,
|
|
162
|
+
...(subgroupDimension?.headers || []),
|
|
163
|
+
...metricColumns.map((c) => c.header),
|
|
164
|
+
],
|
|
101
165
|
style: { head: ["green"] },
|
|
102
166
|
});
|
|
103
|
-
|
|
167
|
+
const truncatedGroups = [];
|
|
168
|
+
for (const [i, group] of groups.entries()) {
|
|
169
|
+
const subgroups = shownSubgroups[i];
|
|
170
|
+
if (subgroupDimension && subgroups.length > 0) {
|
|
171
|
+
const parentCells = parentDimension.cells(group);
|
|
172
|
+
for (const subgroup of subgroups) {
|
|
173
|
+
table.push([
|
|
174
|
+
...parentCells,
|
|
175
|
+
...subgroupDimension.cells(subgroup),
|
|
176
|
+
...metricColumns.map((c) => formatMetric(c, subgroup.metrics?.[0])),
|
|
177
|
+
]);
|
|
178
|
+
}
|
|
179
|
+
const total = group.subgroups.length;
|
|
180
|
+
if (total > subgroups.length) {
|
|
181
|
+
const totalLabel = total >= MAX_SUBGROUPS_PER_GROUP ? `${total}+` : `${total}`;
|
|
182
|
+
truncatedGroups.push(`${parentCells[0]}: ${subgroups.length} of ${totalLabel}`);
|
|
183
|
+
}
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const emptySubgroupCells = subgroupDimension ? subgroupDimension.headers.map(() => "-") : [];
|
|
104
187
|
table.push([
|
|
105
|
-
...
|
|
188
|
+
...parentDimension.cells(group),
|
|
189
|
+
...emptySubgroupCells,
|
|
106
190
|
...metricColumns.map((c) => formatMetric(c, group.metrics?.[0])),
|
|
107
191
|
]);
|
|
108
192
|
}
|
|
@@ -114,7 +198,11 @@ function logReport(report, appId, limit) {
|
|
|
114
198
|
if (totalSize > groups.length && limit < MAX_LIMIT) {
|
|
115
199
|
logger_1.logger.info(`Showing ${groups.length} of ${totalSize} groups. Use '--limit <number>' to show more (up to ${MAX_LIMIT}).`);
|
|
116
200
|
}
|
|
117
|
-
if (
|
|
201
|
+
if (truncatedGroups.length > 0) {
|
|
202
|
+
const what = `${subgroupDimension?.noun || "rows"} per ${parentDimension.noun || "group"}`;
|
|
203
|
+
logger_1.logger.info(`Showing the top ${limit} ${what} (${truncatedGroups.join(", ")}). Use '--limit <number>' to show more (up to ${MAX_LIMIT}).`);
|
|
204
|
+
}
|
|
205
|
+
if (parentDimension.hasSampleEvents || subgroupDimension?.hasSampleEvents) {
|
|
118
206
|
logger_1.logger.info(`Run 'firebase crashlytics:events:get --app ${appId} <sampleEvent>' to inspect a sample event.`);
|
|
119
207
|
}
|
|
120
208
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VALID_FORM_FACTORS = exports.VALID_SIGNALS = exports.VALID_ERROR_TYPES = void 0;
|
|
4
4
|
exports.requireAppId = requireAppId;
|
|
5
|
+
exports.shortEventId = shortEventId;
|
|
5
6
|
exports.parsePositiveIntOption = parsePositiveIntOption;
|
|
6
7
|
exports.writeOutputFileIfRequested = writeOutputFileIfRequested;
|
|
7
8
|
exports.withEventFilterOptions = withEventFilterOptions;
|
|
@@ -28,6 +29,17 @@ function requireAppId(options) {
|
|
|
28
29
|
}
|
|
29
30
|
return appId;
|
|
30
31
|
}
|
|
32
|
+
const EVENT_PATH_PATTERN = /\/events\/([^/]+)$/;
|
|
33
|
+
function shortEventId(sampleEvent) {
|
|
34
|
+
const path = sampleEvent?.split("?")[0].trim();
|
|
35
|
+
if (!path) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
if (!path.includes("/")) {
|
|
39
|
+
return path;
|
|
40
|
+
}
|
|
41
|
+
return path.match(EVENT_PATH_PATTERN)?.[1] || "";
|
|
42
|
+
}
|
|
31
43
|
function parsePositiveIntOption(value, flagName, bounds) {
|
|
32
44
|
const { defaultValue, max } = bounds;
|
|
33
45
|
if (value === undefined || value === "") {
|
|
@@ -77,10 +89,30 @@ function splitCommaSeparatedList(raw) {
|
|
|
77
89
|
if (!raw) {
|
|
78
90
|
return undefined;
|
|
79
91
|
}
|
|
80
|
-
const items =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
const items = [];
|
|
93
|
+
let current = "";
|
|
94
|
+
let parenDepth = 0;
|
|
95
|
+
for (const ch of raw) {
|
|
96
|
+
if (ch === "," && parenDepth === 0) {
|
|
97
|
+
const trimmed = current.trim();
|
|
98
|
+
if (trimmed) {
|
|
99
|
+
items.push(trimmed);
|
|
100
|
+
}
|
|
101
|
+
current = "";
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (ch === "(") {
|
|
105
|
+
parenDepth++;
|
|
106
|
+
}
|
|
107
|
+
else if (ch === ")" && parenDepth > 0) {
|
|
108
|
+
parenDepth--;
|
|
109
|
+
}
|
|
110
|
+
current += ch;
|
|
111
|
+
}
|
|
112
|
+
const trimmed = current.trim();
|
|
113
|
+
if (trimmed) {
|
|
114
|
+
items.push(trimmed);
|
|
115
|
+
}
|
|
84
116
|
return items.length > 0 ? items : undefined;
|
|
85
117
|
}
|
|
86
118
|
function validateEnumList(values, validValues, flagName) {
|
|
@@ -116,10 +148,10 @@ function withEventFilterOptions(command) {
|
|
|
116
148
|
.option("--issue-id <id>", "filter by Crashlytics issue ID")
|
|
117
149
|
.option("--variant-id <id>", "filter by issue variant ID (mobile only)")
|
|
118
150
|
.option("--versions <list>", 'comma-separated version display names (mobile: "2.4.0 (240)", web: "2.4.0")')
|
|
119
|
-
.option("--error-types <list>", "comma-separated error types: FATAL, NON_FATAL, ANR")
|
|
151
|
+
.option("--error-types <list>", "comma-separated error types: FATAL, NON_FATAL, ANR (mobile only; ANR is Android only)")
|
|
120
152
|
.option("--signals <list>", "comma-separated issue signals: SIGNAL_EARLY, SIGNAL_FRESH, SIGNAL_REGRESSED, SIGNAL_REPETITIVE (mobile only)")
|
|
121
153
|
.option("--os-names <list>", 'comma-separated operating system display names (e.g. "Android (14)")')
|
|
122
|
-
.option("--device-names <list>", 'comma-separated device display names (e.g. "Google (Pixel 8)", mobile only)')
|
|
154
|
+
.option("--device-names <list>", 'comma-separated device display names (e.g. "Google (Pixel 8)", "Apple (iPhone16,2)", mobile only)')
|
|
123
155
|
.option("--device-form-factors <list>", "comma-separated device form factors: PHONE, TABLET, DESKTOP, TV, WATCH (mobile only)")
|
|
124
156
|
.option("--browser-names <list>", 'comma-separated browser display names (e.g. "Chrome (123)", web only)')
|
|
125
157
|
.option("--start-time <iso>", 'start of the time interval as an ISO 8601 date or timestamp (e.g. "2026-11-01" or "2026-11-01T08:00:00Z"); within the last 90 days, default: 7 days ago')
|
|
@@ -127,6 +159,7 @@ function withEventFilterOptions(command) {
|
|
|
127
159
|
}
|
|
128
160
|
const MOBILE_ONLY_FLAGS = [
|
|
129
161
|
["variantId", "--variant-id"],
|
|
162
|
+
["errorTypes", "--error-types"],
|
|
130
163
|
["signals", "--signals"],
|
|
131
164
|
["deviceNames", "--device-names"],
|
|
132
165
|
["deviceFormFactors", "--device-form-factors"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_MAX_FRAMES =
|
|
3
|
+
exports.DEFAULT_MAX_FRAMES = void 0;
|
|
4
4
|
exports.listEvents = listEvents;
|
|
5
5
|
exports.normalizeEventResourceName = normalizeEventResourceName;
|
|
6
6
|
exports.batchGetEvents = batchGetEvents;
|
|
@@ -12,7 +12,7 @@ const error_1 = require("../error");
|
|
|
12
12
|
const utils_1 = require("./utils");
|
|
13
13
|
const types_1 = require("./types");
|
|
14
14
|
const filters_1 = require("./filters");
|
|
15
|
-
|
|
15
|
+
const EVENT_DUMP_OPTIONS = { lineWidth: 200 };
|
|
16
16
|
exports.DEFAULT_MAX_FRAMES = 20;
|
|
17
17
|
const DEFAULT_MAX_LOGS = 100;
|
|
18
18
|
const DEFAULT_MAX_BREADCRUMBS = 10;
|
|
@@ -101,69 +101,67 @@ function formatFrames(origFrames, maxFrames = exports.DEFAULT_MAX_FRAMES) {
|
|
|
101
101
|
}
|
|
102
102
|
return formatted;
|
|
103
103
|
}
|
|
104
|
-
function toText(
|
|
105
|
-
if (!event) {
|
|
106
|
-
return {};
|
|
107
|
-
}
|
|
104
|
+
function toText(events, options = {}) {
|
|
108
105
|
const { maxFrames = exports.DEFAULT_MAX_FRAMES, full = false } = options;
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
result["threads"] = threadStrings.join("\n\n");
|
|
144
|
-
}
|
|
145
|
-
else if (key === "exceptions") {
|
|
146
|
-
const exceptions = value || [];
|
|
147
|
-
const exceptionStrings = exceptions.map((exception) => {
|
|
148
|
-
const header = exception.nested ? "Caused by: " : "";
|
|
149
|
-
const exceptionHeader = `${header}${exception.type || ""}: ${exception.exceptionMessage || ""}`;
|
|
150
|
-
const frameStrings = formatFrames(exception.frames || [], effectiveMaxFrames);
|
|
151
|
-
return [exceptionHeader, ...frameStrings].join("\n");
|
|
152
|
-
});
|
|
153
|
-
result["exceptions"] = exceptionStrings.join("\n\n");
|
|
154
|
-
}
|
|
155
|
-
else if (key === "errors") {
|
|
156
|
-
const errors = value || [];
|
|
157
|
-
const errorStrings = errors.map((error) => {
|
|
158
|
-
const header = `Error: ${error.title || "error"}`;
|
|
159
|
-
const frameStrings = formatFrames(error.frames || [], effectiveMaxFrames);
|
|
160
|
-
return [header, ...frameStrings].join("\n");
|
|
161
|
-
});
|
|
162
|
-
result["errors"] = errorStrings.join("\n\n");
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
result[key] = (0, js_yaml_1.dump)(value, exports.EVENT_DUMP_OPTIONS);
|
|
166
|
-
}
|
|
106
|
+
const maxFramesPerTrace = full ? Infinity : maxFrames;
|
|
107
|
+
const formatted = events.map((event) => ({
|
|
108
|
+
...event,
|
|
109
|
+
logs: event.logs && formatLogs(event.logs, full),
|
|
110
|
+
breadcrumbs: event.breadcrumbs && formatBreadcrumbs(event.breadcrumbs, full),
|
|
111
|
+
threads: event.threads && formatThreads(event, full, maxFramesPerTrace),
|
|
112
|
+
exceptions: event.exceptions && formatExceptions(event.exceptions, maxFramesPerTrace),
|
|
113
|
+
errors: event.errors && formatErrors(event.errors, maxFramesPerTrace),
|
|
114
|
+
}));
|
|
115
|
+
return (0, js_yaml_1.dump)(formatted, EVENT_DUMP_OPTIONS);
|
|
116
|
+
}
|
|
117
|
+
function formatLogs(logs, full) {
|
|
118
|
+
const sliced = !full && logs.length > DEFAULT_MAX_LOGS ? logs.slice(-DEFAULT_MAX_LOGS) : logs;
|
|
119
|
+
return sliced.map((log) => `[${log.logTime}] ${log.message}`).join("\n");
|
|
120
|
+
}
|
|
121
|
+
function formatBreadcrumbs(breadcrumbs, full) {
|
|
122
|
+
const sliced = !full && breadcrumbs.length > DEFAULT_MAX_BREADCRUMBS
|
|
123
|
+
? breadcrumbs.slice(-DEFAULT_MAX_BREADCRUMBS)
|
|
124
|
+
: breadcrumbs;
|
|
125
|
+
return sliced
|
|
126
|
+
.map((b) => {
|
|
127
|
+
const paramString = Object.entries(b.params || {})
|
|
128
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
129
|
+
.join(", ");
|
|
130
|
+
const params = paramString ? ` { ${paramString} }` : "";
|
|
131
|
+
return `[${b.eventTime}] ${b.title}${params}`;
|
|
132
|
+
})
|
|
133
|
+
.join("\n");
|
|
134
|
+
}
|
|
135
|
+
function formatThreads(event, full, maxFrames) {
|
|
136
|
+
let threads = event.threads || [];
|
|
137
|
+
if (!full &&
|
|
138
|
+
(event.issue?.errorType === types_1.ErrorType.FATAL || event.issue?.errorType === types_1.ErrorType.ANR)) {
|
|
139
|
+
threads = threads.filter((t) => t.crashed || t.blamed);
|
|
167
140
|
}
|
|
168
|
-
return
|
|
141
|
+
return threads
|
|
142
|
+
.map((thread) => {
|
|
143
|
+
const threadName = thread.name?.trim() || String(thread.threadId ?? "").trim();
|
|
144
|
+
const header = ["Thread:", threadName, thread.crashed ? "(crashed)" : ""]
|
|
145
|
+
.filter(Boolean)
|
|
146
|
+
.join(" ");
|
|
147
|
+
return [header, ...formatFrames(thread.frames || [], maxFrames)].join("\n");
|
|
148
|
+
})
|
|
149
|
+
.join("\n\n");
|
|
150
|
+
}
|
|
151
|
+
function formatExceptions(exceptions, maxFrames) {
|
|
152
|
+
return exceptions
|
|
153
|
+
.map((exception) => {
|
|
154
|
+
const prefix = exception.nested ? "Caused by: " : "";
|
|
155
|
+
const header = `${prefix}${exception.type || ""}: ${exception.exceptionMessage || ""}`;
|
|
156
|
+
return [header, ...formatFrames(exception.frames || [], maxFrames)].join("\n");
|
|
157
|
+
})
|
|
158
|
+
.join("\n\n");
|
|
159
|
+
}
|
|
160
|
+
function formatErrors(errors, maxFrames) {
|
|
161
|
+
return errors
|
|
162
|
+
.map((error) => {
|
|
163
|
+
const header = `Error: ${error.title || "error"}`;
|
|
164
|
+
return [header, ...formatFrames(error.frames || [], maxFrames)].join("\n");
|
|
165
|
+
})
|
|
166
|
+
.join("\n\n");
|
|
169
167
|
}
|
|
@@ -101,21 +101,9 @@ async function createDatabase(context, options) {
|
|
|
101
101
|
async function default_1(context, options) {
|
|
102
102
|
await (0, ensureApiEnabled_1.ensure)(context.projectId, (0, api_1.firestoreOrigin)(), "firestore");
|
|
103
103
|
await (0, ensureApiEnabled_1.ensure)(context.projectId, (0, api_1.firestoreOrigin)(), "firestore");
|
|
104
|
-
if (options.only) {
|
|
105
|
-
const targets = options.only.split(",");
|
|
106
|
-
const excludeRules = targets.includes("firestore:indexes");
|
|
107
|
-
const excludeIndexes = targets.includes("firestore:rules");
|
|
108
|
-
const includeRules = targets.includes("firestore:rules");
|
|
109
|
-
const includeIndexes = targets.includes("firestore:indexes");
|
|
110
|
-
const onlyFirestore = targets.includes("firestore");
|
|
111
|
-
context.firestoreIndexes = !excludeIndexes || includeIndexes || onlyFirestore;
|
|
112
|
-
context.firestoreRules = !excludeRules || includeRules || onlyFirestore;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
context.firestoreIndexes = true;
|
|
116
|
-
context.firestoreRules = true;
|
|
117
|
-
}
|
|
118
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));
|
|
119
107
|
if (!firestoreConfigs || firestoreConfigs.length === 0) {
|
|
120
108
|
return;
|
|
121
109
|
}
|
|
@@ -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 {
|
|
@@ -101,6 +101,12 @@ exports.RUNTIMES = runtimes({
|
|
|
101
101
|
deprecationDate: "2030-10-10",
|
|
102
102
|
decommissionDate: "2031-04-10",
|
|
103
103
|
},
|
|
104
|
+
python315: {
|
|
105
|
+
friendly: "Python 3.15",
|
|
106
|
+
status: "GA",
|
|
107
|
+
deprecationDate: "2031-10-10",
|
|
108
|
+
decommissionDate: "2032-04-10",
|
|
109
|
+
},
|
|
104
110
|
dart3: {
|
|
105
111
|
friendly: "Dart 3",
|
|
106
112
|
status: "experimental",
|
package/lib/deploy/run/deploy.js
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
39
|
-
const
|
|
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
|
-
|
|
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
|
|
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
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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,
|
|
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) {
|
package/lib/downloadUtils.js
CHANGED
|
@@ -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
|
}
|
package/lib/emulator/download.js
CHANGED
|
@@ -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);
|