Skip to content

Commit f49b65a

Browse files
committed
Merge branch 'improvement/enhance-micro-app-debugging' into q/130.0
2 parents 786c3e9 + 75c74ac commit f49b65a

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

shell-ui/src/initFederation/ConfigurationProviders.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function useConfigRetriever(): {
8484
retrieveConfiguration: ({ configType, name }) => {
8585
if (configType !== 'build' && configType !== 'run') {
8686
throw new Error(
87-
`Invalid configType : it should be build or run but recieved ${configType}`,
87+
`Invalid configType : it should be build or run but received ${configType}`,
8888
);
8989
}
9090

@@ -108,13 +108,34 @@ export function useConfigRetriever(): {
108108
})
109109
.map((webFinger) => webFinger.data);
110110
///TODO validate web fingers against JsonSchemas
111-
return configs.find(
111+
const config = configs.find(
112112
(webFinger) =>
113113
(webFinger.kind === 'MicroAppRuntimeConfiguration' &&
114114
webFinger.metadata.name === name) ||
115115
(webFinger.kind === 'MicroAppConfiguration' &&
116116
webFinger.metadata.kind === apps[0].kind),
117117
);
118+
119+
if (!config) {
120+
const listOfKnownConfigurations = JSON.stringify(configs, null, 2);
121+
if (configType === 'build') {
122+
throw new Error(
123+
`MicroApp's MicroAppConfiguration not found for app with kind ${apps[0].kind}.
124+
This error usually happens when your app's "kind" in deployed-ui-apps does not match the MicroAppConfiguration.
125+
Please check your MicroAppConfiguration. Here is a list of known configurations:
126+
${listOfKnownConfigurations}`,
127+
);
128+
}
129+
if (configType === 'run') {
130+
throw new Error(
131+
`MicroApp's RuntimeAppConfiguration not found for app with name ${name} and kind ${apps[0].kind}.
132+
This error usually happens when your app's "name" and "kind" in deployed-ui-apps does not match the RuntimeAppConfiguration.
133+
Please check your RuntimeAppConfiguration. Here is a list of known configurations:
134+
${listOfKnownConfigurations}`,
135+
);
136+
}
137+
}
138+
return config;
118139
},
119140
};
120141
}

0 commit comments

Comments
 (0)