Skip to content

Commit 417be82

Browse files
authored
Use AppSettingsTreeItem constructor instead of async create call (#4578)
* Remove comments * Remove comments
1 parent d059409 commit 417be82

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/tree/ResolvedFunctionAppResource.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ export class ResolvedFunctionAppResource extends ResolvedFunctionAppBase impleme
267267
site: this.site,
268268
contextValuesToAdd: ['azFunc']
269269
});
270-
271-
this.appSettingsTreeItem = await AppSettingsTreeItem.createAppSettingsTreeItem(context, proxyTree, this.site, ext.prefix, {
270+
this.appSettingsTreeItem = new AppSettingsTreeItem(proxyTree, this.site, ext.prefix, {
272271
contextValuesToAdd: ['azFunc'],
273272
});
274273
this._siteFilesTreeItem = new SiteFilesTreeItem(proxyTree, {
@@ -354,8 +353,13 @@ export class ResolvedFunctionAppResource extends ResolvedFunctionAppBase impleme
354353
public async isReadOnly(context: IActionContext): Promise<boolean> {
355354
await this.initSite(context);
356355
const client = await this.site.createClient(context);
357-
const appSettings: StringDictionary = await client.listApplicationSettings();
358-
return [runFromPackageKey, 'WEBSITE_RUN_FROM_ZIP'].some(key => appSettings.properties && envUtils.isEnvironmentVariableSet(appSettings.properties[key]));
356+
try {
357+
const appSettings: StringDictionary = await client.listApplicationSettings();
358+
return [runFromPackageKey, 'WEBSITE_RUN_FROM_ZIP'].some(key => appSettings.properties && envUtils.isEnvironmentVariableSet(appSettings.properties[key]));
359+
} catch (error) {
360+
// if we can't read the app settings, just assume that this is read-only
361+
return true;
362+
}
359363
}
360364

361365
public async deleteTreeItemImpl(context: IActionContext): Promise<void> {

0 commit comments

Comments
 (0)