Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug: UI extension views get no route in 4.1.3 — TypeError: Cannot read properties of undefined (reading 'startsWith')

クローズ 初心者向け
#5,724 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
領域
frontend

調査の方向性

まず ViewRegistry._addView、ViewRegistry.addView、useViewRegistry() から確認し、その後 createRouter() の後に index.ts で拡張スクリプトがどのように追加されているかを確認します。Issue で言及されているリグレッションテストを追加し、バンドルされたカスタム UI によって navbar エントリ “My Extensions” とインスタンスビュー “Custom” が startsWith エラーなしで復元されることを検証します。

索引モデルが issue の本文から書いたものです。

説明

Spring Boot Admin Server information

  • Version: 4.1.3 (still present on master at 9d667167)
  • 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.

主要言語
Java
スター
12.9k
フォーク
3.1k
平均マージ
1日 39分
マージ済み PR(30日)
68

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codecentric/spring-boot-admin のほかの issue

codecentric/spring-boot-admin の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。