Bug: UI extension views get no route in 4.1.3 — TypeError: Cannot read properties of undefined (reading 'startsWith')
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, spring-boot, typescript
- 領域
- 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
masterat 9d667167) - Spring Boot version: 4.1.1
- Configured Security: none needed to reproduce (
insecureprofile 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codecentric/spring-boot-admin のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
codecentric/spring-boot-admin#5743 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
codecentric/spring-boot-admin#5721 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
codecentric/spring-boot-admin#5716 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
type: enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
codecentric/spring-boot-admin#5604 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
codecentric/spring-boot-admin#5597 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
codecentric/spring-boot-admin の issue をすべて見る
似ている issue
-
1.0.0-rc2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
wso2/dpdp-accelerator#377 ·
メンテナーはふだん 1 日以内に返信
-
area/dependencies backport/26.4 kind/cve severity/high source/scan-dependencies status/triage
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信
-
(primitive-collections-base) Use `NumberInput` to parse numeric map keys, as `jackson-databind` doesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FasterXML/jackson-datatypes-collections#270 ·
メンテナーはふだん 1 日以内に返信
-
type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信