Skip to content

GitOps Applications page fails with "Shared module @patternfly/react-topology doesn't exist in shared scope default" #1212

Description

@seiya-koji

Describe the bug

The GitOps Applications page shows nothing when opened.
The following JS error appears in the browser's debug console (F12):

coderef-resolver.ts:77 Failed to load module 'ApplicationList' of plugin gitops-plugin@0.0.17
Error: Shared module @patternfly/react-topology doesn't exist in shared scope default
    at m (consumes:64:8)
    at consumes:67:9
    at u (consumes:81:33)
    at consumes:107:34
    at consumes:77:9
    at 50492 (consumes:139:16)
    at consumes:397:42
    at Array.forEach (<anonymous>)
    at T.f.consumes (consumes:378:25)
    at ensure chunk:6:25

Additionally, opening the "Applications" tab from an ApplicationSet's detail page throws a different JS error:

Cannot access 'X' before initialization
    at exposed-ApplicationSetDetailsPage-chunk-...

To Reproduce

  1. Install OpenShift GitOps Operator on an OCP 4.16 cluster.
  2. Go to the OpenShift web console.
  3. Navigate to the GitOps → Applications page.
  4. See nothing rendered, and the error above in the browser console.

Expected behavior

The Applications page should list the Argo CD Applications in the cluster.

Screenshots

Image

Additional context

The following is speculation, but ApplicationList.tsx (in redhat-developer/gitops-console-plugin) statically imports ApplicationSetGraphView, a component that depends on @patternfly/react-topology. That component is only actually rendered when the appset prop is passed. However, ApplicationList is also registered as the standalone Applications list page, where appset is always undefined.

A static import is evaluated at module-load time regardless of whether the component is actually rendered, so simply opening the standalone list page requires resolving @patternfly/react-topology. The stack trace above (consumes.js, webpack Module Federation's shared-module resolution logic) shows this resolution failing.

I also found that @patternfly/react-topology appears to have become a "Console-provided shared singleton module" only as of OpenShift Console 4.18. gitops-plugin is built against @openshift-console/dynamic-plugin-sdk ^4.19.1, which relies on that assumption (that the Console provides it). My environment is OCP 4.16, so this shared module doesn't exist on the Console side, which I believe is causing the error above.

Since OpenShift GitOps Operator 1.21 officially lists OCP 4.16 as a supported version, if my speculation above is correct, there may be a gap between the officially supported version and the actual build assumptions of the plugin.

Environment

  • Red Hat OpenShift on IBM Cloud: 4.16.63
  • OpenShift GitOps: 1.21.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions