Argo-cd: JS error when using cluster filter in the /application view (TypeError: Cannot read property 'split' of undefined)

Created on 20 Aug 2020  路  11Comments  路  Source: argoproj/argo-cd

If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a
question in argocd slack channel.

Checklist:

  • [x] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • [x] I've included steps to reproduce the bug.
  • [x] I've pasted the output of argocd version.

Describe the bug

This is shown after I login with my Github and choose one of the clusters under clusters filter, it throws

Something went wrong!

Consider submitting an issue here.

Stacktrace:

TypeError: Cannot read property 'split' of undefined
    at m.match (https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:33:43008)
    at h (https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:33:37816)
    at https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:13:308383
    at Array.some (<anonymous>)
    at https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:13:308358
    at Array.filter (<anonymous>)
    at Js (https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:13:307831)
    at Object.children (https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:13:313287)
    at t.render (https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:13:86283)
    at Oi (https://argocd.core-services.rr.mu/main.a781d839f0adbf108587.js:354:63228)

the view_preferences in localStorage is this when the error shown:

{"version":4,"appDetails":{"view":"tree","resourceFilter":["kind:Deployment","kind:Service","kind:Pod","kind:StatefulSet","kind:Ingress","kind:ConfigMap","kind:Job","kind:DaemonSet","kind:Workflow"],"inlineDiff":false,"compactDiff":false,"resourceView":"manifest","orphanedResources":false},"appList":{"view":"tiles","labelsFilter":[],"projectsFilter":[],"namespacesFilter":[],"clustersFilter":["https://163616C2797C009DB3BA93E8E1B59BC5.yl4.us-east-1.eks.amazonaws.com"],"reposFilter":[],"syncFilter":[],"healthFilter":[],"page":0,"search":""},"pageSizes":{}}

Context

  1. We are using Github login as our auth method. (probably not relevant)
  2. but it can work under incognito mode.
  3. but it can work in safari
  4. FIXED by cleaning out the view_preferences

To Reproduce

Go to argocd app, login, choose one of clusters as filter, error shown, remove the view_preference, error gone.

Expected behavior

it should not throw errors.

Screenshots

none

Version

argocd: v1.6.0+c10ae24
  BuildDate: 2020-06-16T22:41:56Z
  GitCommit: c10ae246ab02f1356147118a1979fedcd1ceb704
  GitTreeState: clean
  GoVersion: go1.14.1
  Compiler: gc
  Platform: darwin/amd64
argocd-server: v1.6.2+3d1f37b
  BuildDate: 2020-07-31T23:45:07Z
  GitCommit: 3d1f37b0c53f4c75864dc7339e2831c6e6a947e0
  GitTreeState: clean
  GoVersion: go1.14.1
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: v0.13.1
  Kustomize Version: {Version:kustomize/v3.6.1 GitCommit:c97fa946d576eb6ed559f17f2ac43b3b5a8d5dbd BuildDate:2020-05-27T20:47:35Z GoOs:linux GoArch:amd64}
  Helm Version: version.BuildInfo{Version:"v3.2.0", GitCommit:"e11b7ce3b12db2941e90399e874513fbd24bcb71", GitTreeState:"clean", GoVersion:"go1.13.10"}
  Kubectl Version: v1.14.0

Logs

Paste any relevant application logs here.
bug ui more-information-needed workaround

Most helpful comment

The error disappears after I clear out the view_preferences in localStorage.

All 11 comments

The error disappears after I clear out the view_preferences in localStorage.

@amazingandyyy Have you tried this on v1.7? I can't reproduce. What browser are you using?

@rbreeze I'm personally seeing it on v1.7 in Chrome 84.0.4147.135.

view_preferences contents:

{
  "version": 4,
  "appDetails": {
    "view": "tree",
    "resourceFilter": [
      "kind:Deployment",
      "kind:Service",
      "kind:Pod",
      "kind:StatefulSet",
      "kind:Ingress",
      "kind:ConfigMap",
      "kind:Job",
      "kind:DaemonSet",
      "kind:Workflow"
    ],
    "inlineDiff": false,
    "compactDiff": false,
    "resourceView": "manifest",
    "orphanedResources": false
  },
  "appList": {
    "view": "tiles",
    "labelsFilter": [],
    "projectsFilter": [],
    "namespacesFilter": [],
    "clustersFilter": [
      "https://kubernetes.default.svc"
    ],
    "reposFilter": [],
    "syncFilter": [],
    "healthFilter": [],
    "page": 0,
    "search": ""
  },
  "pageSizes": {}
}

Only shows up when I filter _just_ by cluster. Filtering by namespace and cluster works fine.

Looks like the origin of the bug is this line: https://github.com/argoproj/argo-cd/blob/master/ui/src/app/applications/components/applications-list/applications-list.tsx#L137

(pref.clustersFilter.length === 0 || pref.clustersFilter.some(server => minimatch(app.spec.destination.server, server))) &&

Fails when the app uses destination.name instead of destination.server.

Here's the app I was able to get it to fail with on a locally installed ArgoCD:

project: argoproj
source:
  ...
destination:
  namespace: argocd
  name: in-cluster
syncPolicy:
  automated: {}
ignoreDifferences:
  - kind: ConfigMap
    name: argocd-cm
    namespace: argocd
    jsonPointers:
      - /data/repositories

Based on that, a workaround that works for us is to only use destination.server in our applications. But it also looks like a fix would be pretty simple -- @rbreeze if you're working on other stuff I have some time this week and I could probably get a PR up.

This issue still occur in v1.7.6 with Chrome 85.0.4183.121.

Still seeing the issue in 1.7.7, Chrome 85.0.4183.121 also. Exact error:

Something went wrong!

Consider submitting an issue here.


Stacktrace:

TypeError: Cannot read property 'split' of undefined
    at m.match (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:480154)
    at h (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:474962)
    at https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:313777
    at Array.some (<anonymous>)
    at https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:313752
    at Array.filter (<anonymous>)
    at ec (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:313337)
    at Object.children (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:319077)
    at t.render (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:86283)
    at Oi (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:63228)
    at Ai (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:63023)
    at Yi (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:66858)
    at Ka (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:90782)
    at Xa (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:91166)
    at Ps (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:98191)
    at Ns (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:97571)
    at Hs (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:98950)
    at Cn (https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:30815)
  • The error occurs reliably if I input _any_ namespace filter. All other filter methods seem to work properly for me.
  • To recover, I "delete cookies and all site data" in Chrome, for my internal argocd domain name.
  • Also happen in Safari 15610.1.28.1.9, with the error:
Something went wrong!

Consider submitting an issue here.


Stacktrace:

https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:480201
h@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:475015
some@[native code]
https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:313804
filter@[native code]
https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:33:319127
Oi@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:63476
Ka@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:91026
Xa@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:91410
Ps@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:98435
Ns@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:97815
Hs@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:99194
Cn@https://argocd.k8s.dev.internal.somesite.com/main.2e65a524d04617fac156.js:354:31059
Cn@[native code]

Reproduced that bug with an application which does not have a destination namespace ( namespace field became optional in 1.7 release ). The workaround is to set non-existing namespace name. Fix is on the way: https://github.com/argoproj/argo-cd/pull/4499 . Will cherry-pick into next patch release.

@Asuforce , can you please attache error stack trace? Does it look like https://github.com/argoproj/argo-cd/issues/4134#issuecomment-704356296 ?

@alexmt I just checked and it didn't reproduce. I would let you know if it happens again, along with a log.

@alexmt I can at least confirm we _do_ have objects without destination.namespace. We're using appOfApps to infer namespace such that we don't have to repeat the definition. Thank you so much for the quick ID and turnaround o/

Confirming: v1.7.8 fixes the namespace filter issue. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evrardjp picture evrardjp  路  26Comments

jl431 picture jl431  路  18Comments

StianOvrevage picture StianOvrevage  路  23Comments

guilhermeoki picture guilhermeoki  路  25Comments

rosscdh picture rosscdh  路  20Comments