diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29bb2d..6d294d46c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- Fixed an issue where functions deployment would fail if `firebase.json#extensions` was undefined. (#7575) diff --git a/src/deploy/extensions/planner.ts b/src/deploy/extensions/planner.ts index c051c9e03e3..8ba5cf89869 100644 --- a/src/deploy/extensions/planner.ts +++ b/src/deploy/extensions/planner.ts @@ -131,9 +131,9 @@ export async function have(projectId: string): Promise * any extensions the user has defined that way. * @param args.projectId The project we are deploying to * @param args.projectNumber The project number we are deploying to. - * @param args.extensions The extensions section of firebase.jsonm + * @param args.extensions The extensions section of firebase.json * @param args.emulatorMode Whether the output will be used by the Extensions emulator. - * If true, this will check {instanceId}.env.local for params a + * If true, this will check {instanceId}.env.local for params */ export async function wantDynamic(args: { projectId: string; @@ -143,6 +143,9 @@ export async function wantDynamic(args: { }): Promise { const instanceSpecs: DeploymentInstanceSpec[] = []; const errors: FirebaseError[] = []; + if (!args.extensions) { + return []; + } for (const [instanceId, ext] of Object.entries(args.extensions)) { const autoPopulatedParams = await getFirebaseProjectParams(args.projectId, args.emulatorMode); const subbedParams = substituteParams(ext.params, autoPopulatedParams); @@ -207,6 +210,9 @@ export async function want(args: { }): Promise { const instanceSpecs: DeploymentInstanceSpec[] = []; const errors: FirebaseError[] = []; + if (!args.extensions) { + return []; + } for (const e of Object.entries(args.extensions)) { try { const instanceId = e[0]; diff --git a/src/deploy/extensions/prepare.ts b/src/deploy/extensions/prepare.ts index 7d18a7ef8ae..bf565043c56 100644 --- a/src/deploy/extensions/prepare.ts +++ b/src/deploy/extensions/prepare.ts @@ -188,7 +188,7 @@ export async function prepareDynamicExtensions( projectNumber, aliases, projectDir, - extensions: options.config.get("extensions"), + extensions: options.config.get("extensions", {}), }); noDeleteExtensions = noDeleteExtensions.concat(firebaseJsonWant); if (hasNonDeployingCodebases(options)) { @@ -242,7 +242,7 @@ export async function prepare(context: Context, options: Options, payload: Paylo projectNumber, aliases, projectDir, - extensions: options.config.get("extensions"), + extensions: options.config.get("extensions", {}), }); const dynamicWant = await planner.wantDynamic({ projectId,