firebase-tools-with-isolate 13.6.4 → 13.9.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/README.md +4 -6
- package/lib/api.js +18 -8
- package/lib/apiv2.js +19 -13
- package/lib/apphosting/app.js +69 -0
- package/lib/apphosting/config.js +97 -0
- package/lib/{init/features/apphosting → apphosting}/constants.js +2 -2
- package/lib/apphosting/githubConnections.js +263 -0
- package/lib/apphosting/index.js +319 -0
- package/lib/{init/features/apphosting → apphosting}/repo.js +12 -12
- package/lib/apphosting/secrets/dialogs.js +170 -0
- package/lib/apphosting/secrets/index.js +103 -0
- package/lib/checkValidTargetFilters.js +8 -1
- package/lib/commands/apphosting-backends-create.js +9 -4
- package/lib/commands/apphosting-backends-delete.js +27 -30
- package/lib/commands/apphosting-backends-get.js +8 -8
- package/lib/commands/apphosting-backends-list.js +6 -7
- package/lib/commands/apphosting-secrets-access.js +24 -0
- package/lib/commands/apphosting-secrets-describe.js +29 -0
- package/lib/commands/apphosting-secrets-grantaccess.js +49 -0
- package/lib/commands/apphosting-secrets-set.js +56 -0
- package/lib/commands/dataconnect-sdk-generate.js +37 -0
- package/lib/commands/dataconnect-services-list.js +80 -0
- package/lib/commands/dataconnect-sql-diff.js +25 -0
- package/lib/commands/dataconnect-sql-migrate.js +45 -0
- package/lib/commands/deploy.js +27 -1
- package/lib/commands/firestore-databases-create.js +1 -0
- package/lib/commands/firestore-databases-restore.js +1 -0
- package/lib/commands/functions-secrets-access.js +2 -2
- package/lib/commands/functions-secrets-describe.js +14 -0
- package/lib/commands/functions-secrets-destroy.js +2 -2
- package/lib/commands/functions-secrets-get.js +3 -17
- package/lib/commands/functions-secrets-prune.js +2 -1
- package/lib/commands/functions-secrets-set.js +3 -19
- package/lib/commands/index.js +25 -6
- package/lib/commands/init.js +10 -3
- package/lib/commands/setup-emulators-dataconnect.js +12 -0
- package/lib/config.js +1 -0
- package/lib/dataconnect/build.js +22 -0
- package/lib/dataconnect/checkIam.js +30 -0
- package/lib/dataconnect/client.js +112 -0
- package/lib/dataconnect/dataplaneClient.js +16 -0
- package/lib/dataconnect/ensureApis.js +12 -0
- package/lib/dataconnect/errors.js +29 -0
- package/lib/dataconnect/fileUtils.js +92 -0
- package/lib/dataconnect/filters.js +45 -0
- package/lib/dataconnect/freeTrial.js +22 -0
- package/lib/dataconnect/graphqlError.js +12 -0
- package/lib/dataconnect/load.js +40 -0
- package/lib/dataconnect/names.js +46 -0
- package/lib/dataconnect/prompts.js +20 -0
- package/lib/dataconnect/provisionCloudSql.js +74 -0
- package/lib/dataconnect/schemaMigration.js +246 -0
- package/lib/dataconnect/types.js +22 -0
- package/lib/deploy/dataconnect/deploy.js +75 -0
- package/lib/deploy/dataconnect/index.js +9 -0
- package/lib/deploy/dataconnect/prepare.js +33 -0
- package/lib/deploy/dataconnect/release.js +65 -0
- package/lib/deploy/firestore/prepare.js +4 -2
- package/lib/deploy/functions/checkIam.js +6 -39
- package/lib/deploy/functions/containerCleaner.js +1 -15
- package/lib/deploy/functions/deploy.js +2 -2
- package/lib/deploy/functions/params.js +2 -2
- package/lib/deploy/functions/prepare.js +13 -3
- package/lib/deploy/functions/pricing.js +2 -2
- package/lib/deploy/functions/prompts.js +39 -7
- package/lib/deploy/functions/release/fabricator.js +12 -7
- package/lib/deploy/functions/release/index.js +17 -2
- package/lib/deploy/functions/release/planner.js +11 -3
- package/lib/deploy/functions/runtimes/discovery/index.js +3 -3
- package/lib/deploy/functions/runtimes/index.js +6 -43
- package/lib/deploy/functions/runtimes/node/index.js +3 -2
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +15 -34
- package/lib/deploy/functions/runtimes/python/index.js +10 -7
- package/lib/deploy/functions/runtimes/supported/index.js +80 -0
- package/lib/deploy/functions/runtimes/supported/types.js +74 -0
- package/lib/deploy/functions/services/index.js +4 -0
- package/lib/deploy/index.js +2 -0
- package/lib/downloadUtils.js +3 -2
- package/lib/emulator/constants.js +3 -0
- package/lib/emulator/controller.js +44 -13
- package/lib/emulator/dataconnectEmulator.js +95 -0
- package/lib/emulator/download.js +1 -1
- package/lib/emulator/downloadableEmulators.js +57 -8
- package/lib/emulator/functionsEmulator.js +2 -2
- package/lib/emulator/hub.js +5 -0
- package/lib/emulator/portUtils.js +3 -3
- package/lib/emulator/registry.js +6 -1
- package/lib/emulator/types.js +3 -0
- package/lib/experiments.js +31 -6
- package/lib/extensions/emulator/specHelper.js +9 -42
- package/lib/extensions/extensionsApi.js +2 -2
- package/lib/extensions/localHelper.js +3 -3
- package/lib/firestore/pretty-print.js +5 -0
- package/lib/frameworks/astro/index.js +1 -1
- package/lib/frameworks/flutter/index.js +2 -2
- package/lib/frameworks/next/constants.js +2 -1
- package/lib/frameworks/next/index.js +27 -15
- package/lib/frameworks/next/utils.js +33 -3
- package/lib/functional.js +2 -2
- package/lib/functions/events/v2.js +7 -1
- package/lib/functions/python.js +4 -3
- package/lib/functions/secrets.js +40 -22
- package/lib/gcp/apphosting.js +25 -3
- package/lib/gcp/cloudbuild.js +7 -3
- package/lib/gcp/cloudfunctions.js +5 -5
- package/lib/gcp/cloudfunctionsv2.js +3 -3
- package/lib/gcp/cloudscheduler.js +2 -2
- package/lib/gcp/cloudsql/cloudsqladmin.js +174 -0
- package/lib/gcp/cloudsql/connect.js +144 -0
- package/lib/gcp/cloudsql/fbToolsAuthClient.js +44 -0
- package/lib/gcp/computeEngine.js +7 -0
- package/lib/gcp/devConnect.js +25 -12
- package/lib/gcp/firedata.js +27 -0
- package/lib/gcp/iam.js +41 -1
- package/lib/gcp/secretManager.js +55 -7
- package/lib/gcp/serviceusage.js +24 -5
- package/lib/hosting/interactive.js +4 -0
- package/lib/init/features/dataconnect/index.js +166 -0
- package/lib/init/features/emulators.js +13 -1
- package/lib/init/features/functions/index.js +19 -3
- package/lib/init/features/functions/npm-dependencies.js +12 -23
- package/lib/init/features/functions/python.js +4 -3
- package/lib/init/features/genkit.js +53 -0
- package/lib/init/features/hosting/github.js +4 -5
- package/lib/init/features/index.js +6 -2
- package/lib/init/index.js +2 -0
- package/lib/init/spawn.js +23 -0
- package/lib/logger.js +22 -2
- package/lib/operation-poller.js +8 -2
- package/lib/rc.js +9 -1
- package/lib/requireAuth.js +1 -8
- package/lib/requireTosAcceptance.js +22 -0
- package/lib/utils.js +76 -8
- package/package.json +11 -5
- package/schema/connector-yaml.json +54 -0
- package/schema/dataconnect-yaml.json +72 -0
- package/schema/firebase-config.json +115 -2
- package/templates/extensions/javascript/package.lint.json +2 -2
- package/templates/extensions/javascript/package.nolint.json +2 -2
- package/templates/extensions/typescript/package.lint.json +2 -2
- package/templates/extensions/typescript/package.nolint.json +2 -2
- package/templates/init/dataconnect/connector.yaml +2 -0
- package/templates/init/dataconnect/dataconnect.yaml +10 -0
- package/templates/init/dataconnect/mutations.gql +30 -0
- package/templates/init/dataconnect/queries.gql +51 -0
- package/templates/init/dataconnect/schema.gql +28 -0
- package/templates/init/functions/javascript/_gitignore +2 -1
- package/templates/init/functions/javascript/package.lint.json +2 -2
- package/templates/init/functions/javascript/package.nolint.json +2 -2
- package/templates/init/functions/python/_gitignore +1 -0
- package/templates/init/functions/typescript/_eslintrc +1 -0
- package/templates/init/functions/typescript/_gitignore +1 -0
- package/templates/init/functions/typescript/package.lint.json +2 -2
- package/templates/init/functions/typescript/package.nolint.json +2 -2
- package/lib/init/features/apphosting/index.js +0 -229
- package/lib/monospace/index.js +0 -82
- /package/lib/{monospace/interfaces.js → gcp/cloudsql/types.js} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureServiceAgentRoles = exports.
|
|
3
|
+
exports.ensureServiceAgentRoles = exports.obtainDefaultComputeServiceAgentBindings = exports.obtainPubSubServiceAgentBindings = exports.checkHttpIam = exports.checkServiceAccountIam = exports.EVENTARC_EVENT_RECEIVER_ROLE = exports.RUN_INVOKER_ROLE = exports.SERVICE_ACCOUNT_TOKEN_CREATOR_ROLE = void 0;
|
|
4
4
|
const colorette_1 = require("colorette");
|
|
5
5
|
const logger_1 = require("../../logger");
|
|
6
6
|
const functionsDeployHelper_1 = require("./functionsDeployHelper");
|
|
7
7
|
const error_1 = require("../../error");
|
|
8
8
|
const functional_1 = require("../../functional");
|
|
9
9
|
const iam = require("../../gcp/iam");
|
|
10
|
+
const gce = require("../../gcp/computeEngine");
|
|
10
11
|
const backend = require("./backend");
|
|
11
12
|
const track_1 = require("../../track");
|
|
12
13
|
const utils = require("../../utils");
|
|
@@ -73,10 +74,6 @@ exports.checkHttpIam = checkHttpIam;
|
|
|
73
74
|
function getPubsubServiceAgent(projectNumber) {
|
|
74
75
|
return `service-${projectNumber}@gcp-sa-pubsub.iam.gserviceaccount.com`;
|
|
75
76
|
}
|
|
76
|
-
function getDefaultComputeServiceAgent(projectNumber) {
|
|
77
|
-
return `${projectNumber}-compute@developer.gserviceaccount.com`;
|
|
78
|
-
}
|
|
79
|
-
exports.getDefaultComputeServiceAgent = getDefaultComputeServiceAgent;
|
|
80
77
|
function reduceEventsToServices(services, endpoint) {
|
|
81
78
|
const service = (0, services_1.serviceForEndpoint)(endpoint);
|
|
82
79
|
if (service.requiredProjectBindings && !services.find((s) => s.name === service.name)) {
|
|
@@ -93,7 +90,7 @@ function obtainPubSubServiceAgentBindings(projectNumber) {
|
|
|
93
90
|
}
|
|
94
91
|
exports.obtainPubSubServiceAgentBindings = obtainPubSubServiceAgentBindings;
|
|
95
92
|
function obtainDefaultComputeServiceAgentBindings(projectNumber) {
|
|
96
|
-
const defaultComputeServiceAgent = `serviceAccount:${
|
|
93
|
+
const defaultComputeServiceAgent = `serviceAccount:${gce.getDefaultServiceAccount(projectNumber)}`;
|
|
97
94
|
const runInvokerBinding = {
|
|
98
95
|
role: exports.RUN_INVOKER_ROLE,
|
|
99
96
|
members: [defaultComputeServiceAgent],
|
|
@@ -105,36 +102,6 @@ function obtainDefaultComputeServiceAgentBindings(projectNumber) {
|
|
|
105
102
|
return [runInvokerBinding, eventarcEventReceiverBinding];
|
|
106
103
|
}
|
|
107
104
|
exports.obtainDefaultComputeServiceAgentBindings = obtainDefaultComputeServiceAgentBindings;
|
|
108
|
-
function mergeBindings(policy, requiredBindings) {
|
|
109
|
-
let updated = false;
|
|
110
|
-
for (const requiredBinding of requiredBindings) {
|
|
111
|
-
const match = policy.bindings.find((b) => b.role === requiredBinding.role);
|
|
112
|
-
if (!match) {
|
|
113
|
-
updated = true;
|
|
114
|
-
policy.bindings.push(requiredBinding);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
for (const requiredMember of requiredBinding.members) {
|
|
118
|
-
if (!match.members.find((m) => m === requiredMember)) {
|
|
119
|
-
updated = true;
|
|
120
|
-
match.members.push(requiredMember);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return updated;
|
|
125
|
-
}
|
|
126
|
-
exports.mergeBindings = mergeBindings;
|
|
127
|
-
function printManualIamConfig(requiredBindings, projectId) {
|
|
128
|
-
utils.logLabeledBullet("functions", "Failed to verify the project has the correct IAM bindings for a successful deployment.", "warn");
|
|
129
|
-
utils.logLabeledBullet("functions", "You can either re-run `firebase deploy` as a project owner or manually run the following set of `gcloud` commands:", "warn");
|
|
130
|
-
for (const binding of requiredBindings) {
|
|
131
|
-
for (const member of binding.members) {
|
|
132
|
-
utils.logLabeledBullet("functions", `\`gcloud projects add-iam-policy-binding ${projectId} ` +
|
|
133
|
-
`--member=${member} ` +
|
|
134
|
-
`--role=${binding.role}\``, "warn");
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
105
|
async function ensureServiceAgentRoles(projectId, projectNumber, want, have) {
|
|
139
106
|
const wantServices = backend.allEndpoints(want).reduce(reduceEventsToServices, []);
|
|
140
107
|
const haveServices = backend.allEndpoints(have).reduce(reduceEventsToServices, []);
|
|
@@ -160,13 +127,13 @@ async function ensureServiceAgentRoles(projectId, projectNumber, want, have) {
|
|
|
160
127
|
policy = await (0, resourceManager_1.getIamPolicy)(projectNumber);
|
|
161
128
|
}
|
|
162
129
|
catch (err) {
|
|
163
|
-
printManualIamConfig(requiredBindings, projectId);
|
|
130
|
+
iam.printManualIamConfig(requiredBindings, projectId, "functions");
|
|
164
131
|
utils.logLabeledBullet("functions", "Could not verify the necessary IAM configuration for the following newly-integrated services: " +
|
|
165
132
|
`${newServices.map((service) => service.api).join(", ")}` +
|
|
166
133
|
". Deployment may fail.", "warn");
|
|
167
134
|
return;
|
|
168
135
|
}
|
|
169
|
-
const hasUpdatedBindings = mergeBindings(policy, requiredBindings);
|
|
136
|
+
const hasUpdatedBindings = iam.mergeBindings(policy, requiredBindings);
|
|
170
137
|
if (!hasUpdatedBindings) {
|
|
171
138
|
return;
|
|
172
139
|
}
|
|
@@ -174,7 +141,7 @@ async function ensureServiceAgentRoles(projectId, projectNumber, want, have) {
|
|
|
174
141
|
await (0, resourceManager_1.setIamPolicy)(projectNumber, policy, "bindings");
|
|
175
142
|
}
|
|
176
143
|
catch (err) {
|
|
177
|
-
printManualIamConfig(requiredBindings, projectId);
|
|
144
|
+
iam.printManualIamConfig(requiredBindings, projectId, "functions");
|
|
178
145
|
throw new error_1.FirebaseError("We failed to modify the IAM policy for the project. The functions " +
|
|
179
146
|
"deployment requires specific roles to be granted to service agents," +
|
|
180
147
|
" otherwise the deployment will fail.", { original: err });
|
|
@@ -49,7 +49,7 @@ async function cleanupBuildImages(haveFunctions, deletedFunctions, cleaners = {}
|
|
|
49
49
|
}));
|
|
50
50
|
cleanup.push(...deletedFunctions.map(async (func) => {
|
|
51
51
|
try {
|
|
52
|
-
await
|
|
52
|
+
await arCleaner.cleanupFunction(func);
|
|
53
53
|
}
|
|
54
54
|
catch (err) {
|
|
55
55
|
const path = `${func.project}/${func.region}/gcf-artifacts`;
|
|
@@ -110,17 +110,6 @@ class ArtifactRegistryCleaner {
|
|
|
110
110
|
operationResourceName: op.name,
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
async cleanupFunctionCache(func) {
|
|
114
|
-
const op = await artifactregistry.deletePackage(`${ArtifactRegistryCleaner.packagePath(func)}%2Fcache`);
|
|
115
|
-
if (op.done) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
await poller.pollOperation({
|
|
119
|
-
...ArtifactRegistryCleaner.POLLER_OPTIONS,
|
|
120
|
-
pollerName: `cleanup-cache-${func.region}-${func.id}`,
|
|
121
|
-
operationResourceName: op.name,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
113
|
}
|
|
125
114
|
exports.ArtifactRegistryCleaner = ArtifactRegistryCleaner;
|
|
126
115
|
ArtifactRegistryCleaner.POLLER_OPTIONS = {
|
|
@@ -132,9 +121,6 @@ class NoopArtifactRegistryCleaner extends ArtifactRegistryCleaner {
|
|
|
132
121
|
cleanupFunction() {
|
|
133
122
|
return Promise.resolve();
|
|
134
123
|
}
|
|
135
|
-
cleanupFunctionCache() {
|
|
136
|
-
return Promise.resolve();
|
|
137
|
-
}
|
|
138
124
|
}
|
|
139
125
|
exports.NoopArtifactRegistryCleaner = NoopArtifactRegistryCleaner;
|
|
140
126
|
class ContainerRegistryCleaner {
|
|
@@ -25,7 +25,7 @@ async function uploadSourceV1(projectId, source, wantBackend) {
|
|
|
25
25
|
stream: fs.createReadStream(source.functionsSourceV1),
|
|
26
26
|
};
|
|
27
27
|
if (process.env.GOOGLE_CLOUD_QUOTA_PROJECT) {
|
|
28
|
-
(0, utils_1.logLabeledWarning)("functions", "
|
|
28
|
+
(0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUOTA_PROJECT is not usable when uploading source for Cloud Functions.");
|
|
29
29
|
}
|
|
30
30
|
await gcs.upload(uploadOpts, uploadUrl, {
|
|
31
31
|
"x-goog-content-length-range": "0,104857600",
|
|
@@ -44,7 +44,7 @@ async function uploadSourceV2(projectId, source, wantBackend) {
|
|
|
44
44
|
stream: fs.createReadStream(source.functionsSourceV2),
|
|
45
45
|
};
|
|
46
46
|
if (process.env.GOOGLE_CLOUD_QUOTA_PROJECT) {
|
|
47
|
-
(0, utils_1.logLabeledWarning)("functions", "
|
|
47
|
+
(0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUOTA_PROJECT is not usable when uploading source for Cloud Functions.");
|
|
48
48
|
}
|
|
49
49
|
await gcs.upload(uploadOpts, res.uploadUrl, undefined, true);
|
|
50
50
|
return res.storageSource;
|
|
@@ -8,7 +8,7 @@ const functional_1 = require("../../functional");
|
|
|
8
8
|
const secretManager = require("../../gcp/secretManager");
|
|
9
9
|
const storage_1 = require("../../gcp/storage");
|
|
10
10
|
const cel_1 = require("./cel");
|
|
11
|
-
const
|
|
11
|
+
const secretManager_1 = require("../../gcp/secretManager");
|
|
12
12
|
function dependenciesCEL(expr) {
|
|
13
13
|
const deps = [];
|
|
14
14
|
const paramCapture = /{{ params\.(\w+) }}/g;
|
|
@@ -222,7 +222,7 @@ async function handleSecret(secretParam, projectId) {
|
|
|
222
222
|
type: "password",
|
|
223
223
|
message: `This secret will be stored in Cloud Secret Manager (https://cloud.google.com/secret-manager/pricing) as ${secretParam.name}. Enter a value for ${secretParam.label || secretParam.name}:`,
|
|
224
224
|
});
|
|
225
|
-
await secretManager.createSecret(projectId, secretParam.name, (0,
|
|
225
|
+
await secretManager.createSecret(projectId, secretParam.name, (0, secretManager_1.labels)());
|
|
226
226
|
await secretManager.addVersion(projectId, secretParam.name, secretValue);
|
|
227
227
|
return secretValue;
|
|
228
228
|
}
|
|
@@ -8,6 +8,7 @@ const ensureApiEnabled = require("../../ensureApiEnabled");
|
|
|
8
8
|
const functionsConfig = require("../../functionsConfig");
|
|
9
9
|
const functionsEnv = require("../../functions/env");
|
|
10
10
|
const runtimes = require("./runtimes");
|
|
11
|
+
const supported = require("./runtimes/supported");
|
|
11
12
|
const validate = require("./validate");
|
|
12
13
|
const ensure = require("./ensure");
|
|
13
14
|
const api_1 = require("../../api");
|
|
@@ -284,12 +285,21 @@ async function loadCodebases(config, options, firebaseConfig, runtimeConfig, fil
|
|
|
284
285
|
projectId,
|
|
285
286
|
sourceDir,
|
|
286
287
|
projectDir: options.config.projectDir,
|
|
287
|
-
runtime: codebaseConfig.runtime
|
|
288
|
+
runtime: codebaseConfig.runtime,
|
|
288
289
|
};
|
|
290
|
+
const firebaseJsonRuntime = codebaseConfig.runtime;
|
|
291
|
+
if (firebaseJsonRuntime && !supported.isRuntime(firebaseJsonRuntime)) {
|
|
292
|
+
throw new error_1.FirebaseError(`Functions codebase ${codebase} has invalid runtime ` +
|
|
293
|
+
`${firebaseJsonRuntime} specified in firebase.json. Valid values are: ` +
|
|
294
|
+
Object.keys(supported.RUNTIMES)
|
|
295
|
+
.map((s) => `- ${s}`)
|
|
296
|
+
.join("\n"));
|
|
297
|
+
}
|
|
289
298
|
const runtimeDelegate = await runtimes.getRuntimeDelegate(delegateContext);
|
|
290
|
-
logger_1.logger.debug(`Validating ${runtimeDelegate.
|
|
299
|
+
logger_1.logger.debug(`Validating ${runtimeDelegate.language} source`);
|
|
300
|
+
supported.guardVersionSupport(runtimeDelegate.runtime);
|
|
291
301
|
await runtimeDelegate.validate();
|
|
292
|
-
logger_1.logger.debug(`Building ${runtimeDelegate.
|
|
302
|
+
logger_1.logger.debug(`Building ${runtimeDelegate.language} source`);
|
|
293
303
|
await runtimeDelegate.build();
|
|
294
304
|
const firebaseEnvs = functionsEnv.loadFirebaseEnvs(firebaseConfig, projectId);
|
|
295
305
|
(0, utils_1.logLabeledBullet)("functions", `Loading and analyzing source code for codebase ${codebase} to determine what to deploy`);
|
|
@@ -107,7 +107,7 @@ const MB_TO_GHZ = {
|
|
|
107
107
|
32768: 8 * VCPU_TO_GHZ,
|
|
108
108
|
};
|
|
109
109
|
function canCalculateMinInstanceCost(endpoint) {
|
|
110
|
-
if (
|
|
110
|
+
if (endpoint.minInstances === undefined || endpoint.minInstances === null) {
|
|
111
111
|
return true;
|
|
112
112
|
}
|
|
113
113
|
if (endpoint.platform === "gcfv1") {
|
|
@@ -132,7 +132,7 @@ function monthlyMinInstanceCost(endpoints) {
|
|
|
132
132
|
gcfv2: { 1: { ram: 0, cpu: 0 }, 2: { ram: 0, cpu: 0 } },
|
|
133
133
|
};
|
|
134
134
|
for (const endpoint of endpoints) {
|
|
135
|
-
if (
|
|
135
|
+
if (endpoint.minInstances === undefined || endpoint.minInstances === null) {
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
138
|
const ramMb = endpoint.availableMemoryMb || backend.DEFAULT_MEMORY;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptForMinInstances = exports.promptForFunctionDeletion = exports.promptForFailurePolicies = void 0;
|
|
3
|
+
exports.promptForMinInstances = exports.promptForUnsafeMigration = exports.promptForFunctionDeletion = exports.promptForFailurePolicies = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
5
|
const functionsDeployHelper_1 = require("./functionsDeployHelper");
|
|
6
6
|
const error_1 = require("../../error");
|
|
@@ -48,16 +48,16 @@ async function promptForFailurePolicies(options, want, have) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
exports.promptForFailurePolicies = promptForFailurePolicies;
|
|
51
|
-
async function promptForFunctionDeletion(functionsToDelete,
|
|
51
|
+
async function promptForFunctionDeletion(functionsToDelete, options) {
|
|
52
52
|
let shouldDeleteFns = true;
|
|
53
|
-
if (functionsToDelete.length === 0 || force) {
|
|
53
|
+
if (functionsToDelete.length === 0 || options.force) {
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
56
|
const deleteList = functionsToDelete
|
|
57
57
|
.sort(backend.compareFunctions)
|
|
58
58
|
.map((fn) => "\t" + (0, functionsDeployHelper_1.getFunctionLabel)(fn))
|
|
59
59
|
.join("\n");
|
|
60
|
-
if (nonInteractive) {
|
|
60
|
+
if (options.nonInteractive) {
|
|
61
61
|
const deleteCommands = functionsToDelete
|
|
62
62
|
.map((func) => {
|
|
63
63
|
return "\tfirebase functions:delete " + func.id + " --region " + func.region;
|
|
@@ -74,9 +74,7 @@ async function promptForFunctionDeletion(functionsToDelete, force, nonInteractiv
|
|
|
74
74
|
"\n\nIf you are renaming a function or changing its region, it is recommended that you create the new " +
|
|
75
75
|
"function first before deleting the old one to prevent event loss. For more info, visit " +
|
|
76
76
|
clc.underline("https://firebase.google.com/docs/functions/manage-functions#modify" + "\n"));
|
|
77
|
-
shouldDeleteFns = await (0, prompt_1.
|
|
78
|
-
type: "confirm",
|
|
79
|
-
name: "confirm",
|
|
77
|
+
shouldDeleteFns = await (0, prompt_1.confirm)({
|
|
80
78
|
default: false,
|
|
81
79
|
message: "Would you like to proceed with deletion? Selecting no will continue the rest of the deployments.",
|
|
82
80
|
});
|
|
@@ -84,6 +82,40 @@ async function promptForFunctionDeletion(functionsToDelete, force, nonInteractiv
|
|
|
84
82
|
return shouldDeleteFns;
|
|
85
83
|
}
|
|
86
84
|
exports.promptForFunctionDeletion = promptForFunctionDeletion;
|
|
85
|
+
async function promptForUnsafeMigration(fnsToUpdate, options) {
|
|
86
|
+
const unsafeUpdates = fnsToUpdate.filter((eu) => eu.unsafe);
|
|
87
|
+
if (unsafeUpdates.length === 0 || options.force) {
|
|
88
|
+
return fnsToUpdate;
|
|
89
|
+
}
|
|
90
|
+
const warnMessage = "The following functions are unsafely changing event types: " +
|
|
91
|
+
clc.bold(unsafeUpdates
|
|
92
|
+
.map((eu) => eu.endpoint)
|
|
93
|
+
.sort(backend.compareFunctions)
|
|
94
|
+
.map(functionsDeployHelper_1.getFunctionLabel)
|
|
95
|
+
.join(", ")) +
|
|
96
|
+
". " +
|
|
97
|
+
"While automatic migration is allowed for these functions, updating the underlying event type may result in data loss. " +
|
|
98
|
+
"To avoid this, consider the best practices outlined in the migration guide: https://firebase.google.com/docs/functions/manage-functions?gen=2nd#modify-trigger";
|
|
99
|
+
utils.logLabeledWarning("functions", warnMessage);
|
|
100
|
+
const safeUpdates = fnsToUpdate.filter((eu) => !eu.unsafe);
|
|
101
|
+
if (options.nonInteractive) {
|
|
102
|
+
utils.logLabeledWarning("functions", "Skipping updates for functions that may be unsafe to update. To update these functions anyway, deploy again in interactive mode or use the --force option.");
|
|
103
|
+
return safeUpdates;
|
|
104
|
+
}
|
|
105
|
+
for (const eu of unsafeUpdates) {
|
|
106
|
+
const shouldUpdate = await (0, prompt_1.promptOnce)({
|
|
107
|
+
type: "confirm",
|
|
108
|
+
name: "confirm",
|
|
109
|
+
default: false,
|
|
110
|
+
message: `[${(0, functionsDeployHelper_1.getFunctionLabel)(eu.endpoint)}] Would you like to proceed with the unsafe migration?`,
|
|
111
|
+
});
|
|
112
|
+
if (shouldUpdate) {
|
|
113
|
+
safeUpdates.push(eu);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return safeUpdates;
|
|
117
|
+
}
|
|
118
|
+
exports.promptForUnsafeMigration = promptForUnsafeMigration;
|
|
87
119
|
async function promptForMinInstances(options, want, have) {
|
|
88
120
|
if (options.force) {
|
|
89
121
|
return;
|
|
@@ -7,7 +7,7 @@ const error_1 = require("../../../error");
|
|
|
7
7
|
const sourceTokenScraper_1 = require("./sourceTokenScraper");
|
|
8
8
|
const timer_1 = require("./timer");
|
|
9
9
|
const functional_1 = require("../../../functional");
|
|
10
|
-
const
|
|
10
|
+
const supported_1 = require("../runtimes/supported");
|
|
11
11
|
const api_1 = require("../../../api");
|
|
12
12
|
const logger_1 = require("../../../logger");
|
|
13
13
|
const backend = require("../backend");
|
|
@@ -16,6 +16,7 @@ const deploymentTool = require("../../../deploymentTool");
|
|
|
16
16
|
const gcf = require("../../../gcp/cloudfunctions");
|
|
17
17
|
const gcfV2 = require("../../../gcp/cloudfunctionsv2");
|
|
18
18
|
const eventarc = require("../../../gcp/eventarc");
|
|
19
|
+
const experiments = require("../../../experiments");
|
|
19
20
|
const helper = require("../functionsDeployHelper");
|
|
20
21
|
const poller = require("../../../operation-poller");
|
|
21
22
|
const pubsub = require("../../../gcp/pubsub");
|
|
@@ -25,7 +26,7 @@ const scheduler = require("../../../gcp/cloudscheduler");
|
|
|
25
26
|
const utils = require("../../../utils");
|
|
26
27
|
const services = require("../services");
|
|
27
28
|
const v1_1 = require("../../../functions/events/v1");
|
|
28
|
-
const
|
|
29
|
+
const gce = require("../../../gcp/computeEngine");
|
|
29
30
|
const functionsDeployHelper_1 = require("../functionsDeployHelper");
|
|
30
31
|
const gcfV1PollerOptions = {
|
|
31
32
|
apiOrigin: (0, api_1.functionsOrigin)(),
|
|
@@ -283,7 +284,9 @@ class Fabricator {
|
|
|
283
284
|
while (!resultFunction) {
|
|
284
285
|
resultFunction = await this.functionExecutor
|
|
285
286
|
.run(async () => {
|
|
286
|
-
|
|
287
|
+
if (experiments.isEnabled("functionsv2deployoptimizations")) {
|
|
288
|
+
apiFunction.buildConfig.sourceToken = await scraper.getToken();
|
|
289
|
+
}
|
|
287
290
|
const op = await gcfV2.createFunction(apiFunction);
|
|
288
291
|
return await poller.pollOperation({
|
|
289
292
|
...gcfV2PollerOptions,
|
|
@@ -344,7 +347,7 @@ class Fabricator {
|
|
|
344
347
|
else if (backend.isScheduleTriggered(endpoint)) {
|
|
345
348
|
const invoker = endpoint.serviceAccount
|
|
346
349
|
? [endpoint.serviceAccount]
|
|
347
|
-
: [
|
|
350
|
+
: [gce.getDefaultServiceAccount(this.projectNumber)];
|
|
348
351
|
await this.executor
|
|
349
352
|
.run(() => run.setInvokerCreate(endpoint.project, serviceName, invoker))
|
|
350
353
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
@@ -399,7 +402,9 @@ class Fabricator {
|
|
|
399
402
|
}
|
|
400
403
|
const resultFunction = await this.functionExecutor
|
|
401
404
|
.run(async () => {
|
|
402
|
-
|
|
405
|
+
if (experiments.isEnabled("functionsv2deployoptimizations")) {
|
|
406
|
+
apiFunction.buildConfig.sourceToken = await scraper.getToken();
|
|
407
|
+
}
|
|
403
408
|
const op = await gcfV2.updateFunction(apiFunction);
|
|
404
409
|
return await poller.pollOperation({
|
|
405
410
|
...gcfV2PollerOptions,
|
|
@@ -435,7 +440,7 @@ class Fabricator {
|
|
|
435
440
|
else if (backend.isScheduleTriggered(endpoint)) {
|
|
436
441
|
invoker = endpoint.serviceAccount
|
|
437
442
|
? [endpoint.serviceAccount]
|
|
438
|
-
: [
|
|
443
|
+
: [gce.getDefaultServiceAccount(this.projectNumber)];
|
|
439
444
|
}
|
|
440
445
|
if (invoker) {
|
|
441
446
|
await this.executor
|
|
@@ -590,7 +595,7 @@ class Fabricator {
|
|
|
590
595
|
.catch(rethrowAs(endpoint, "unregister blocking trigger"));
|
|
591
596
|
}
|
|
592
597
|
logOpStart(op, endpoint) {
|
|
593
|
-
const runtime =
|
|
598
|
+
const runtime = supported_1.RUNTIMES[endpoint.runtime].friendly;
|
|
594
599
|
const platform = (0, functionsDeployHelper_1.getHumanFriendlyPlatformName)(endpoint.platform);
|
|
595
600
|
const label = helper.getFunctionLabel(endpoint);
|
|
596
601
|
utils.logLabeledBullet("functions", `${op} ${runtime} (${platform}) function ${clc.bold(label)}...`);
|
|
@@ -11,6 +11,7 @@ const fabricator = require("./fabricator");
|
|
|
11
11
|
const reporter = require("./reporter");
|
|
12
12
|
const executor = require("./executor");
|
|
13
13
|
const prompts = require("../prompts");
|
|
14
|
+
const experiments = require("../../../experiments");
|
|
14
15
|
const functionsConfig_1 = require("../../../functionsConfig");
|
|
15
16
|
const functionsDeployHelper_1 = require("../functionsDeployHelper");
|
|
16
17
|
const error_1 = require("../../../error");
|
|
@@ -40,12 +41,24 @@ async function release(context, options, payload) {
|
|
|
40
41
|
const fnsToDelete = Object.values(plan)
|
|
41
42
|
.map((regionalChanges) => regionalChanges.endpointsToDelete)
|
|
42
43
|
.reduce(functional_1.reduceFlat, []);
|
|
43
|
-
const shouldDelete = await prompts.promptForFunctionDeletion(fnsToDelete, options
|
|
44
|
+
const shouldDelete = await prompts.promptForFunctionDeletion(fnsToDelete, options);
|
|
44
45
|
if (!shouldDelete) {
|
|
45
46
|
for (const change of Object.values(plan)) {
|
|
46
47
|
change.endpointsToDelete = [];
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
const fnsToUpdate = Object.values(plan)
|
|
51
|
+
.map((regionalChanges) => regionalChanges.endpointsToUpdate)
|
|
52
|
+
.reduce(functional_1.reduceFlat, []);
|
|
53
|
+
const fnsToUpdateSafe = await prompts.promptForUnsafeMigration(fnsToUpdate, options);
|
|
54
|
+
for (const key of Object.keys(plan)) {
|
|
55
|
+
plan[key].endpointsToUpdate = [];
|
|
56
|
+
}
|
|
57
|
+
for (const eu of fnsToUpdateSafe) {
|
|
58
|
+
const e = eu.endpoint;
|
|
59
|
+
const key = `${e.codebase || ""}-${e.region}-${e.availableMemoryMb || "default"}`;
|
|
60
|
+
plan[key].endpointsToUpdate.push(eu);
|
|
61
|
+
}
|
|
49
62
|
const throttlerOptions = {
|
|
50
63
|
retries: 30,
|
|
51
64
|
backoff: 20000,
|
|
@@ -68,7 +81,9 @@ async function release(context, options, payload) {
|
|
|
68
81
|
const deletedEndpoints = Object.values(plan)
|
|
69
82
|
.map((r) => r.endpointsToDelete)
|
|
70
83
|
.reduce(functional_1.reduceFlat, []);
|
|
71
|
-
|
|
84
|
+
if (experiments.isEnabled("automaticallydeletegcfartifacts")) {
|
|
85
|
+
await containerCleaner.cleanupBuildImages(haveEndpoints, deletedEndpoints);
|
|
86
|
+
}
|
|
72
87
|
const allErrors = summary.results.filter((r) => r.error).map((r) => r.error);
|
|
73
88
|
if (allErrors.length) {
|
|
74
89
|
const opts = allErrors.length === 1 ? { original: allErrors[0] } : { children: allErrors };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkForV2Upgrade = exports.checkForIllegalUpdate = exports.upgradedScheduleFromV1ToV2 = exports.changedV2PubSubTopic = exports.changedTriggerRegion = exports.upgradedToGCFv2WithoutSettingConcurrency = exports.createDeploymentPlan = exports.calculateUpdate = exports.calculateChangesets = void 0;
|
|
4
|
-
const clc = require("colorette");
|
|
3
|
+
exports.checkForV2Upgrade = exports.checkForIllegalUpdate = exports.checkForUnsafeUpdate = exports.upgradedScheduleFromV1ToV2 = exports.changedV2PubSubTopic = exports.changedTriggerRegion = exports.upgradedToGCFv2WithoutSettingConcurrency = exports.createDeploymentPlan = exports.calculateUpdate = exports.calculateChangesets = void 0;
|
|
5
4
|
const functionsDeployHelper_1 = require("../functionsDeployHelper");
|
|
6
5
|
const deploymentTool_1 = require("../../../deploymentTool");
|
|
7
6
|
const error_1 = require("../../../error");
|
|
8
7
|
const utils = require("../../../utils");
|
|
9
8
|
const backend = require("../backend");
|
|
10
9
|
const v2events = require("../../../functions/events/v2");
|
|
10
|
+
const v2_1 = require("../../../functions/events/v2");
|
|
11
11
|
function calculateChangesets(want, have, keyFn, deleteAll) {
|
|
12
12
|
const toCreate = utils.groupBy(Object.keys(want)
|
|
13
13
|
.filter((id) => !have[id])
|
|
@@ -29,7 +29,7 @@ function calculateChangesets(want, have, keyFn, deleteAll) {
|
|
|
29
29
|
}, {});
|
|
30
30
|
const toSkip = utils.groupBy(Object.values(toSkipEndpointsMap), keyFn);
|
|
31
31
|
if (Object.keys(toSkip).length) {
|
|
32
|
-
utils.logLabeledBullet("functions",
|
|
32
|
+
utils.logLabeledBullet("functions", "Skipping the deploy of unchanged functions.");
|
|
33
33
|
}
|
|
34
34
|
const toUpdate = utils.groupBy(Object.keys(want)
|
|
35
35
|
.filter((id) => have[id])
|
|
@@ -57,6 +57,7 @@ function calculateUpdate(want, have) {
|
|
|
57
57
|
checkForIllegalUpdate(want, have);
|
|
58
58
|
const update = {
|
|
59
59
|
endpoint: want,
|
|
60
|
+
unsafe: checkForUnsafeUpdate(want, have),
|
|
60
61
|
};
|
|
61
62
|
const needsDelete = changedTriggerRegion(want, have) ||
|
|
62
63
|
changedV2PubSubTopic(want, have) ||
|
|
@@ -163,6 +164,13 @@ function upgradedScheduleFromV1ToV2(want, have) {
|
|
|
163
164
|
return true;
|
|
164
165
|
}
|
|
165
166
|
exports.upgradedScheduleFromV1ToV2 = upgradedScheduleFromV1ToV2;
|
|
167
|
+
function checkForUnsafeUpdate(want, have) {
|
|
168
|
+
return (backend.isEventTriggered(want) &&
|
|
169
|
+
v2_1.FIRESTORE_EVENT_WITH_AUTH_CONTEXT_REGEX.test(want.eventTrigger.eventType) &&
|
|
170
|
+
backend.isEventTriggered(have) &&
|
|
171
|
+
v2_1.FIRESTORE_EVENT_REGEX.test(have.eventTrigger.eventType));
|
|
172
|
+
}
|
|
173
|
+
exports.checkForUnsafeUpdate = checkForUnsafeUpdate;
|
|
166
174
|
function checkForIllegalUpdate(want, have) {
|
|
167
175
|
const triggerType = (e) => {
|
|
168
176
|
if (backend.isHttpsTriggered(e)) {
|
|
@@ -4,7 +4,7 @@ exports.detectFromPort = exports.detectFromYaml = exports.yamlToBuild = exports.
|
|
|
4
4
|
const node_fetch_1 = require("node-fetch");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
7
|
-
const yaml = require("
|
|
7
|
+
const yaml = require("yaml");
|
|
8
8
|
const util_1 = require("util");
|
|
9
9
|
const logger_1 = require("../../../../logger");
|
|
10
10
|
const api = require("../../.../../../../api");
|
|
@@ -41,7 +41,7 @@ async function detectFromYaml(directory, project, runtime) {
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
logger_1.logger.debug("Found functions.yaml. Got spec:", text);
|
|
44
|
-
const parsed = yaml.
|
|
44
|
+
const parsed = yaml.parse(text);
|
|
45
45
|
return yamlToBuild(parsed, project, api.functionsDefaultRegion(), runtime);
|
|
46
46
|
}
|
|
47
47
|
exports.detectFromYaml = detectFromYaml;
|
|
@@ -74,7 +74,7 @@ async function detectFromPort(port, project, runtime, timeout = 10000) {
|
|
|
74
74
|
logger_1.logger.debug("Got response from /__/functions.yaml", text);
|
|
75
75
|
let parsed;
|
|
76
76
|
try {
|
|
77
|
-
parsed = yaml.
|
|
77
|
+
parsed = yaml.parse(text);
|
|
78
78
|
}
|
|
79
79
|
catch (err) {
|
|
80
80
|
logger_1.logger.debug("Failed to parse functions.yaml", err);
|
|
@@ -1,61 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRuntimeDelegate =
|
|
3
|
+
exports.getRuntimeDelegate = void 0;
|
|
4
4
|
const node = require("./node");
|
|
5
5
|
const python = require("./python");
|
|
6
6
|
const validate = require("../validate");
|
|
7
7
|
const error_1 = require("../../../error");
|
|
8
|
-
const
|
|
9
|
-
"nodejs10",
|
|
10
|
-
"nodejs12",
|
|
11
|
-
"nodejs14",
|
|
12
|
-
"nodejs16",
|
|
13
|
-
"nodejs18",
|
|
14
|
-
"nodejs20",
|
|
15
|
-
"python310",
|
|
16
|
-
"python311",
|
|
17
|
-
"python312",
|
|
18
|
-
];
|
|
19
|
-
const EXPERIMENTAL_RUNTIMES = [];
|
|
20
|
-
const DEPRECATED_RUNTIMES = ["nodejs6", "nodejs8"];
|
|
21
|
-
function isDeprecatedRuntime(runtime) {
|
|
22
|
-
return DEPRECATED_RUNTIMES.includes(runtime);
|
|
23
|
-
}
|
|
24
|
-
exports.isDeprecatedRuntime = isDeprecatedRuntime;
|
|
25
|
-
function isValidRuntime(runtime) {
|
|
26
|
-
return RUNTIMES.includes(runtime) || EXPERIMENTAL_RUNTIMES.includes(runtime);
|
|
27
|
-
}
|
|
28
|
-
exports.isValidRuntime = isValidRuntime;
|
|
29
|
-
const MESSAGE_FRIENDLY_RUNTIMES = {
|
|
30
|
-
nodejs6: "Node.js 6 (Deprecated)",
|
|
31
|
-
nodejs8: "Node.js 8 (Deprecated)",
|
|
32
|
-
nodejs10: "Node.js 10",
|
|
33
|
-
nodejs12: "Node.js 12",
|
|
34
|
-
nodejs14: "Node.js 14",
|
|
35
|
-
nodejs16: "Node.js 16",
|
|
36
|
-
nodejs18: "Node.js 18",
|
|
37
|
-
nodejs20: "Node.js 20",
|
|
38
|
-
python310: "Python 3.10",
|
|
39
|
-
python311: "Python 3.11",
|
|
40
|
-
python312: "Python 3.12",
|
|
41
|
-
};
|
|
42
|
-
function getHumanFriendlyRuntimeName(runtime) {
|
|
43
|
-
return MESSAGE_FRIENDLY_RUNTIMES[runtime] || runtime;
|
|
44
|
-
}
|
|
45
|
-
exports.getHumanFriendlyRuntimeName = getHumanFriendlyRuntimeName;
|
|
8
|
+
const supported = require("./supported");
|
|
46
9
|
const factories = [node.tryCreateDelegate, python.tryCreateDelegate];
|
|
47
10
|
async function getRuntimeDelegate(context) {
|
|
48
11
|
const { projectDir, sourceDir, runtime } = context;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
throw new error_1.FirebaseError(`Cannot deploy function with runtime ${runtime}`);
|
|
12
|
+
if (runtime && !supported.isRuntime(runtime)) {
|
|
13
|
+
throw new error_1.FirebaseError(`firebase.json specifies invalid runtime ${runtime} for directory ${sourceDir}`);
|
|
52
14
|
}
|
|
15
|
+
validate.functionsDirectoryExists(sourceDir, projectDir);
|
|
53
16
|
for (const factory of factories) {
|
|
54
17
|
const delegate = await factory(context);
|
|
55
18
|
if (delegate) {
|
|
56
19
|
return delegate;
|
|
57
20
|
}
|
|
58
21
|
}
|
|
59
|
-
throw new error_1.FirebaseError(`Could not detect
|
|
22
|
+
throw new error_1.FirebaseError(`Could not detect runtime for functions at ${sourceDir}`);
|
|
60
23
|
}
|
|
61
24
|
exports.getRuntimeDelegate = getRuntimeDelegate;
|
|
@@ -13,6 +13,7 @@ const parseRuntimeAndValidateSDK_1 = require("./parseRuntimeAndValidateSDK");
|
|
|
13
13
|
const logger_1 = require("../../../../logger");
|
|
14
14
|
const utils_1 = require("../../../../utils");
|
|
15
15
|
const discovery = require("../discovery");
|
|
16
|
+
const supported = require("../supported");
|
|
16
17
|
const validate = require("./validate");
|
|
17
18
|
const versioning = require("./versioning");
|
|
18
19
|
const parseTriggers = require("./parseTriggers");
|
|
@@ -25,7 +26,7 @@ async function tryCreateDelegate(context) {
|
|
|
25
26
|
return undefined;
|
|
26
27
|
}
|
|
27
28
|
const runtime = (0, parseRuntimeAndValidateSDK_1.getRuntimeChoice)(context.sourceDir, context.runtime);
|
|
28
|
-
if (!
|
|
29
|
+
if (!supported.runtimeIsLanguage(runtime, "nodejs")) {
|
|
29
30
|
logger_1.logger.debug("Customer has a package.json but did not get a nodejs runtime. This should not happen");
|
|
30
31
|
throw new error_1.FirebaseError(`Unexpected runtime ${runtime}`);
|
|
31
32
|
}
|
|
@@ -38,7 +39,7 @@ class Delegate {
|
|
|
38
39
|
this.projectDir = projectDir;
|
|
39
40
|
this.sourceDir = sourceDir;
|
|
40
41
|
this.runtime = runtime;
|
|
41
|
-
this.
|
|
42
|
+
this.language = "nodejs";
|
|
42
43
|
this._sdkVersion = undefined;
|
|
43
44
|
this._bin = "";
|
|
44
45
|
}
|