Skip to content

UI: store.getters.zones.filter is not a function on first login for User-type roles (race between listZones and listApis) #14847

Backlog

Description

@antonvdl

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

  1. 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.
  2. Create an account with that role and a user, and authorise the user for SAML.
  3. Open a new private browser window and log in through SAML.
  4. In the network tab, listApis returns before listZones; the UI stays empty and the console shows store.getters.zones.filter is not a function.
  5. 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

  1. boring-cyborg commented on Nov 25, 2026

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions