You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UI: store.getters.zones.filter is not a function on first login for User-type roles (race between listZones and listApis) #14847
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, listNetworkServiceProviders and cloudianIsEnabled, 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, listApis returns before listZones; the UI stays empty and the console shows store.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 zones as [] in the state of ui/src/store/modules/user.js.
Wait for listZones (and SET_ZONES) before dispatching GenerateRoutes in GetInfo.
Guard the show functions in ui/src/config/section/network.js (and the vnfapp details) with Array.isArray(store.getters.zones).
Any one of the first two fixes the race; the guard makes the menu robust against a missing zone list.
Activity
boring-cyborg commentedon Nov 25, 2026
Thanks for opening your first issue here! Be sure to follow the issue template!