Spring Boot Admin Server information
- Version: 4.1.3 (still present on
master at 9d66716)
- Spring Boot version: 4.1.1
- Configured Security: none needed to reproduce (
insecure profile of the servlet sample); same with basic auth
- Webflux or Servlet application: Servlet
Client information
- Spring Boot versions: any, not client-related
- Used discovery mechanism: self registration
- Webflux or Servlet application: Servlet
Description
Since 4.1.3, views that a UI extension registers via SBA.viewRegistry.addView(...) or SBA.use({ install({ viewRegistry }) { ... } }) are added to the registry, but no route is created for them. The browser console shows:
TypeError: Cannot read properties of undefined (reading 'startsWith')
Top-level extension views disappear from the navbar, and instance views are missing from the sidebar. 4.1.2 works.
Reproduce with the bundled sample: run spring-boot-admin-sample-servlet, which includes spring-boot-admin-sample-custom-ui, with the insecure profile. On 4.1.3 the "My Extensions" navbar entry and the "Custom" instance view are gone, and the console shows the error above.
Screenshots and recordings (4.1.3 vs. 4.1.3 + fix) are attached in the first comment.
Our own extension registers instance views like this and is affected the same way:
SBA.viewRegistry.addView({
name: 'instances/acme-caches',
parent: 'instances',
path: 'acme-caches',
component: Caches,
label: 'Caches',
group: 'acme',
order: 1002,
isEnabled: ({ instance }) => instance.hasEndpoint('acme-caches'),
});
Cause: #5542 made ViewRegistry._addView async, so ViewRegistry.addView now returns Promise<SbaView>[]. useViewRegistry().addView (which is what SBA.viewRegistry exposes) still treats the result as views:
const view = viewRegistry.addView(viewToAdd)[0]; // a Promise now
...
ensureAbsolutePath(view.path) // view.path === undefined -> throws
That branch only runs once the router exists. Extension scripts are appended as <script> tags in index.ts and run after createRouter(), so every extension view goes through it. _addView itself never awaits anything; only isEnabled needs to accept a promise.
I have a fix with a regression test ready and will open a PR.
Spring Boot Admin Server information
masterat 9d66716)insecureprofile of the servlet sample); same with basic authClient information
Description
Since 4.1.3, views that a UI extension registers via
SBA.viewRegistry.addView(...)orSBA.use({ install({ viewRegistry }) { ... } })are added to the registry, but no route is created for them. The browser console shows:Top-level extension views disappear from the navbar, and instance views are missing from the sidebar. 4.1.2 works.
Reproduce with the bundled sample: run
spring-boot-admin-sample-servlet, which includesspring-boot-admin-sample-custom-ui, with theinsecureprofile. On 4.1.3 the "My Extensions" navbar entry and the "Custom" instance view are gone, and the console shows the error above.Screenshots and recordings (4.1.3 vs. 4.1.3 + fix) are attached in the first comment.
Our own extension registers instance views like this and is affected the same way:
Cause: #5542 made
ViewRegistry._addViewasync, soViewRegistry.addViewnow returnsPromise<SbaView>[].useViewRegistry().addView(which is whatSBA.viewRegistryexposes) still treats the result as views:That branch only runs once the router exists. Extension scripts are appended as
<script>tags inindex.tsand run aftercreateRouter(), so every extension view goes through it._addViewitself never awaits anything; onlyisEnabledneeds to accept a promise.I have a fix with a regression test ready and will open a PR.