From d25544318f2199d0b9ce898f7be242b265f260d4 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Thu, 29 Sep 2022 15:50:33 -0700 Subject: [PATCH 1/2] Fix bug where function configuration with null cannot be loaded by firebase-functions admin binary. --- spec/runtime/manifest.spec.ts | 30 ++++++++++++++++++++++++++++++ src/runtime/manifest.ts | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/spec/runtime/manifest.spec.ts b/spec/runtime/manifest.spec.ts index 96a330914..382a0b41e 100644 --- a/spec/runtime/manifest.spec.ts +++ b/spec/runtime/manifest.spec.ts @@ -7,6 +7,36 @@ describe('stackToWire', () => { params.clearParams(); }); + it('converts stack with null values values', () => { + const stack: ManifestStack = { + endpoints: { + v2http: { + platform: 'gcfv2', + entryPoint: 'v2http', + labels: {}, + httpsTrigger: {}, + maxInstances: null, + }, + }, + requiredAPIs: [], + specVersion: 'v1alpha1', + }; + const expected = { + endpoints: { + v2http: { + platform: 'gcfv2', + entryPoint: 'v2http', + labels: {}, + httpsTrigger: {}, + maxInstances: null, + }, + }, + requiredAPIs: [], + specVersion: 'v1alpha1', + }; + expect(stackToWire(stack)).to.deep.equal(expected); + }); + it('converts Expression types in endpoint options to CEL', () => { const intParam = params.defineInt('foo', { default: 11 }); const stringParam = params.defineString('bar', { diff --git a/src/runtime/manifest.ts b/src/runtime/manifest.ts index d53165420..553854ae0 100644 --- a/src/runtime/manifest.ts +++ b/src/runtime/manifest.ts @@ -107,7 +107,7 @@ export function stackToWire(stack: ManifestStack): Object { for (const [key, val] of Object.entries(obj)) { if (val instanceof Expression) { obj[key] = val.toCEL(); - } else if (typeof val === 'object') { + } else if (typeof val === 'object' && val !== null) { traverse(val); } } From 50b01f5b9f7e7c12e37590c9058024980603d49e Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Thu, 29 Sep 2022 15:52:51 -0700 Subject: [PATCH 2/2] Add changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0df54b4ec..f6a8ba1bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,2 @@ - Fix reference docs for performance monitoring. +- Fix bug where function configuration wil null values couldn't be deployed. (#1246)