UI: store.getters.zones.filter is not a function on first login for User-type roles (race between listZones and listApis)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
- 领域
- frontend
调研方向
从 ui/src/store/modules/user.js 开始,跟踪 GetInfo 以及 listZones、listApis 和 GenerateRoutes,确认报告的竞态。然后检查 ui/src/config/section/network.js 中的 show 函数和 vnfapp 详情,查找其他未受保护的 zone 查询。当使用所述角色重新登录后页面加载时不再出现控制台错误,issue 即告完成;请在新的隐私会话中验证所报告的行为。
由索引模型根据 Issue 内容生成。
描述
problem
On a fresh session the UI stays empty and the console shows:
TypeError: store.getters.zones.filter is not a function
at Object.show (network.js)
...
at GenerateRoutes (permission.js)
A reload (F5) fixes it. We see it for users with a User-type role and a short API list; a DomainAdmin user with a longer API list usually does not hit it.
Cause: in ui/src/store/modules/user.js the state starts with zones: {} (an object, not an array). GetInfo starts listZones and listApis in parallel and dispatches GenerateRoutes as soon as listApis returns, without waiting for listZones. When listApis returns first, the show of the securitygroups section in ui/src/config/section/network.js calls store.getters.zones.filter(...) on {}. The createNetwork show and the vnfapp details have the same unguarded call. On a reload the cached branch of GetInfo commits the zones from local storage before anything else, so there is no race.
versions
Apache CloudStack 4.22.1.0 (management server and UI), KVM, advanced zones. Login via SAML2 (Keycloak). The same code (zones: {} and no wait on listZones before GenerateRoutes) is on the 4.22 branch and on main.
The steps to reproduce the bug
- Create a custom role of type User with a short allow-list that includes
listApis,listZones,listSecurityGroups,listUsers,listCapabilities,listLdapConfigurations,listNetworkServiceProvidersandcloudianIsEnabled, ending with*,deny. - Create an account with that role and a user, and authorise the user for SAML.
- Open a new private browser window and log in through SAML.
- In the network tab,
listApisreturns beforelistZones; the UI stays empty and the console showsstore.getters.zones.filter is not a function. - Press F5: the UI loads normally.
It is timing dependent: the shorter the API list of the role, the more often listApis wins.
What to do about it?
- Initialise
zonesas[]in the state ofui/src/store/modules/user.js. - Wait for
listZones(andSET_ZONES) before dispatchingGenerateRoutesinGetInfo. - Guard the
showfunctions inui/src/config/section/network.js(and thevnfappdetails) withArray.isArray(store.getters.zones).
Any one of the first two fixes the race; the guard makes the menu robust against a missing zone list.
- 主要语言
- Java
- 星标
- 3.1k
- 派生
- 1.4k
- 平均合并
- 6 天 1 小时
- 30 天内合并 PR
- 16
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/cloudstack 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
apache/cloudstack#14900 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
apache/cloudstack#14897 ·
维护者通常 1 天内回复
-
ROUTED VPC router drops replies to its own traffic over a private gateway可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 62/100
apache/cloudstack#14784 ·
维护者通常 1 天内回复
-
Snapshot lookup by zone ignores the zone in its fallback (stray semicolon)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
apache/cloudstack#14770 ·
维护者通常 1 天内回复
-
CKS: validate-cks-node merges missing package names into one string on Debian/Ubuntu可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
apache/cloudstack#14755 · 1 条评论 ·
维护者通常 1 天内回复
查看 apache/cloudstack 的全部 Issue
相似的 Issue
-
bug needs triage
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
升级 AIDEV 初始化基础镜像至 0.1.7可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭backlog kind/enhancement
难度 1/5 1 小时以内 新手友好度 88/100
TencentBlueKing/bk-job#4640 ·
维护者通常 1 天内回复
-
Identify Apache Seata as incubating in the GitHub repository description可能已有人在做 @slievrly 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
apache/incubator-seata#8404 ·
维护者通常 1 天内回复
-
Track FLINK-41442: on Flink 2.1+ an unaligned checkpoint can lose a split assigned just before it未关闭area:docs bug module:bigtable module:spanner priority:P3 status:blocked-upstream
难度 2/5 1-3 小时 新手友好度 72/100
flink-gcp/flink-connector-gcp#2411 ·
维护者通常 1 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复