From 199b657b0083195077d95a60fef328048c3972f2 Mon Sep 17 00:00:00 2001 From: Long Alan Date: Mon, 9 Aug 2021 15:03:01 +0800 Subject: [PATCH 1/2] add check for manifest.endpoints --- extensions/azurePublish/src/node/deploy.ts | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/extensions/azurePublish/src/node/deploy.ts b/extensions/azurePublish/src/node/deploy.ts index 7a5ac3c870..064f8fe872 100644 --- a/extensions/azurePublish/src/node/deploy.ts +++ b/extensions/azurePublish/src/node/deploy.ts @@ -193,20 +193,22 @@ export class BotProjectDeploy { const manifest = await fs.readJson(path.join(skillSettingsPath, manifestFile)); - const endpointIndex = manifest.endpoints.findIndex((x) => x.name === profileName); - if (endpointIndex > -1) { - // already exists - return; - } - manifest.endpoints.push({ - protocol: 'BotFrameworkV3', - name: profileName, - endpointUrl: hostEndpoint, - description: '', - msAppId: msAppId, - }); + if (manifest.endpoints) { + const endpointIndex = manifest.endpoints.findIndex((x) => x.name === profileName); + if (endpointIndex > -1) { + // already exists + return; + } + manifest.endpoints.push({ + protocol: 'BotFrameworkV3', + name: profileName, + endpointUrl: hostEndpoint, + description: '', + msAppId: msAppId, + }); - await fs.writeJson(path.join(skillSettingsPath, manifestFile), manifest, { spaces: 2 }); + await fs.writeJson(path.join(skillSettingsPath, manifestFile), manifest, { spaces: 2 }); + } } } From 368d76b36e040620862e4d48e59686e074c1f0f7 Mon Sep 17 00:00:00 2001 From: Long Alan Date: Thu, 12 Aug 2021 11:16:28 +0800 Subject: [PATCH 2/2] set endpoints to [] when manifest has no endpoints --- extensions/azurePublish/src/node/deploy.ts | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/extensions/azurePublish/src/node/deploy.ts b/extensions/azurePublish/src/node/deploy.ts index e103f7d959..1ff9b10903 100644 --- a/extensions/azurePublish/src/node/deploy.ts +++ b/extensions/azurePublish/src/node/deploy.ts @@ -193,22 +193,21 @@ export class BotProjectDeploy { const manifest = await fs.readJson(path.join(skillSettingsPath, manifestFile)); - if (manifest.endpoints) { - const endpointIndex = manifest.endpoints.findIndex((x) => x.name === profileName); - if (endpointIndex > -1) { - // already exists - return; - } - manifest.endpoints.push({ - protocol: 'BotFrameworkV3', - name: profileName, - endpointUrl: hostEndpoint, - description: '', - msAppId: msAppId, - }); - - await fs.writeJson(path.join(skillSettingsPath, manifestFile), manifest, { spaces: 2 }); + manifest.endpoints = manifest.endpoints || []; + const endpointIndex = manifest.endpoints.findIndex((x) => x.name === profileName); + if (endpointIndex > -1) { + // already exists + return; } + manifest.endpoints.push({ + protocol: 'BotFrameworkV3', + name: profileName, + endpointUrl: hostEndpoint, + description: '', + msAppId: msAppId, + }); + + await fs.writeJson(path.join(skillSettingsPath, manifestFile), manifest, { spaces: 2 }); } }