openrca/orca-ui

Invalid root for alerts payload

bzurkowski opened this issue · 0 comments

After deployment in testbed, alerts dashboard fails with error:

TypeError: Cannot read property 'map' of undefined
    at Alerts.js:26

Code:

  loadData() {
    axios.get(process.env.REACT_APP_BACKEND_HOST + '/v1/alerts')
      .then((response) => {
        const alerts = response.data.alerts.map(alert => {
          alert.updated_at = new Date(1000 * alert.updated_at);
          return alert;
        });
...

There is no alerts root in alerts payload:

[
    {
        "id": "falco-alert-attach/exec-pod-pod-arangodb-7fc5bc8fbc-bz7w2-rca",
        "origin": "falco",
        "name": "Attach/Exec Pod",
        "message": "18:27:54.593231872: Notice Attach/Exec to pod (user=kubernetes-admin pod=arangodb-7fc5bc8fbc-bz7w2 ns=rca action=exec command=python3)",
        "severity": "Notice",
        "source": {
            "origin": null,
            "kind": null,
            "properties": {
                "name": null,
                "namespace": "n/a"
            }
        },
        "created_at": "1598293671",
        "updated_at": "1598293683"
    },