Skip to content

Commit a6b2452

Browse files
authored
Overwrite the site object as to not accidentally reset it (#4144)
1 parent cb8140a commit a6b2452

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/FunctionAppResolver.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ export class FunctionAppResolver implements AppResourceResolver {
2424
const sites20231201 = await getSites20231201(context, subContext);
2525
await Promise.all(sites.map(async (site): Promise<void> => {
2626
const id = nonNullProp(site, 'id').toLowerCase();
27-
const s = sites20231201.find(s => s.id?.toLowerCase() === site.id?.toLowerCase());
28-
this.siteCache.set(id, Object.assign(site, { isFlex: !!s?.properties?.functionAppConfig }));
29-
27+
// check for required properties that sometime don't exist in the LIST operation
3028
if (!site.defaultHostName) {
3129
// if this required property doesn't exist, try getting the full site payload
32-
const fullSite = await client.webApps.get(nonNullProp(site, 'resourceGroup'), nonNullProp(site, 'name'))
33-
this.siteCache.set(id, fullSite);
30+
site = await client.webApps.get(nonNullProp(site, 'resourceGroup'), nonNullProp(site, 'name'))
31+
this.siteCache.set(id, site);
3432
}
33+
34+
const s = sites20231201.find(s => s.id?.toLowerCase() === site.id?.toLowerCase());
35+
this.siteCache.set(id, Object.assign(site, { isFlex: !!s?.properties?.functionAppConfig }));
36+
3537
}));
3638
this.siteCacheLastUpdated = Date.now();
3739
}

0 commit comments

Comments
 (0)