4949import java .time .Duration ;
5050import java .util .List ;
5151import java .util .Map ;
52+ import java .util .Optional ;
5253import java .util .stream .Collectors ;
5354
5455import static com .microsoft .intellij .ui .messages .AzureBundle .message ;
@@ -65,6 +66,7 @@ public class FunctionDeploymentState extends AzureRunProfileState<IFunctionApp>
6566 "because they are non-anonymous. To access the non-anonymous triggers, please refer https://aka.ms/azure-functions-key." ;
6667 private static final String FAILED_TO_LIST_TRIGGERS = "Deployment succeeded, but failed to list http trigger urls." ;
6768 private static final String SYNCING_TRIGGERS_AND_FETCH_FUNCTION_INFORMATION = "Syncing triggers and fetching function information..." ;
69+ private static final String NO_TRIGGERS_FOUNDED = "No triggers found in deployed function app" ;
6870
6971 private final FunctionDeployConfiguration functionDeployConfiguration ;
7072 private final FunctionDeployModel deployModel ;
@@ -125,7 +127,7 @@ private IFunctionApp createFunctionApp(@NotNull RunProcessHandler processHandler
125127 }
126128
127129 private void updateApplicationSettings (IFunctionApp deployTarget ) {
128- final Map <String , String > applicationSettings = functionDeployConfiguration .getAppSettings ( );
130+ final Map <String , String > applicationSettings = FunctionUtils . loadAppSettingsFromSecurityStorage ( functionDeployConfiguration .getAppSettingsKey () );
129131 if (MapUtils .isEmpty (applicationSettings )) {
130132 return ;
131133 }
@@ -241,7 +243,10 @@ private List<FunctionEntity> listFunctions(final IFunctionApp functionApp) {
241243 AzureMessager .getMessager ().info (SYNCING_TRIGGERS_AND_FETCH_FUNCTION_INFORMATION );
242244 return Mono .fromCallable (() -> {
243245 functionApp .syncTriggers ();
244- return functionApp .listFunctions (true );
246+ final List <FunctionEntity > entities = functionApp .listFunctions (true );
247+ return Optional .ofNullable (functionApp .listFunctions (true ))
248+ .filter (CollectionUtils ::isNotEmpty )
249+ .orElseThrow (() -> new AzureToolkitRuntimeException (NO_TRIGGERS_FOUNDED ));
245250 }).retryWhen (Retry .withThrowable (flux ->
246251 flux .zipWith (Flux .range (1 , LIST_TRIGGERS_MAX_RETRY + 1 ), (throwable , count ) -> {
247252 if (count < LIST_TRIGGERS_MAX_RETRY ) {
0 commit comments