{"action":"created","issue":{"url":"https://api.github.com/repos/dcos/dcos-ui/issues/3956","repository_url":"https://api.github.com/repos/dcos/dcos-ui","labels_url":"https://api.github.com/repos/dcos/dcos-ui/issues/3956/labels{/name}","comments_url":"https://api.github.com/repos/dcos/dcos-ui/issues/3956/comments","events_url":"https://api.github.com/repos/dcos/dcos-ui/issues/3956/events","html_url":"https://github.com/dcos/dcos-ui/pull/3956","id":460907163,"node_id":"MDExOlB1bGxSZXF1ZXN0MjkxOTM3NDg4","number":3956,"title":"DCOS-50023: Fail to display error coming from the service resume action","user":{"login":"GeorgiSTodorov","id":40791275,"node_id":"MDQ6VXNlcjQwNzkxMjc1","avatar_url":"https://avatars2.githubusercontent.com/u/40791275?v=4","gravatar_id":"","url":"https://api.github.com/users/GeorgiSTodorov","html_url":"https://github.com/GeorgiSTodorov","followers_url":"https://api.github.com/users/GeorgiSTodorov/followers","following_url":"https://api.github.com/users/GeorgiSTodorov/following{/other_user}","gists_url":"https://api.github.com/users/GeorgiSTodorov/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgiSTodorov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgiSTodorov/subscriptions","organizations_url":"https://api.github.com/users/GeorgiSTodorov/orgs","repos_url":"https://api.github.com/users/GeorgiSTodorov/repos","events_url":"https://api.github.com/users/GeorgiSTodorov/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgiSTodorov/received_events","type":"User","site_admin":false},"labels":[{"id":1409944507,"node_id":"MDU6TGFiZWwxNDA5OTQ0NTA3","url":"https://api.github.com/repos/dcos/dcos-ui/labels/Bug%20Fix","name":"Bug Fix","color":"67bbef","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-06-26T11:09:27Z","updated_at":"2019-07-01T21:23:28Z","closed_at":"2019-07-01T18:58:10Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/dcos/dcos-ui/pulls/3956","html_url":"https://github.com/dcos/dcos-ui/pull/3956","diff_url":"https://github.com/dcos/dcos-ui/pull/3956.diff","patch_url":"https://github.com/dcos/dcos-ui/pull/3956.patch"},"body":"Check if details is an array before trying\r\nto use the reduce function on it.\r\n\r\nCloses https://jira.mesosphere.com/browse/DCOS-50023\r\n\r\n## Testing\r\nVerify that the added check makes sense given the sentry error.\r\n(Optional) In `ServiceResumeModal` replace the `componentWillReceiveProps` function with the following so that we reach the error code and verify that the UI doesn't break when the modal is used.\r\n```\r\n  componentWillReceiveProps(nextProps) {\r\n    let errorMsg = \"\";\r\n    const details = \"123\";\r\n    const hasDetails = details && details.length !== 0;\r\n\r\n    if (hasDetails && Array.isArray(details)) {\r\n      errorMsg = details.reduce(function(memo, error) {\r\n        return `${memo} ${error.errors.join(\" \")}`;\r\n      }, \"\");\r\n    }\r\n\r\n    if (!errorMsg || !errorMsg.length) {\r\n      errorMsg = null;\r\n    }\r\n\r\n    this.setState({ errorMsg });\r\n  }\r\n```\r\n\r\n## Trade-offs\r\nI can only speculate what the problem is, especially since the related sentry bug no longer exists.\r\nMy assumption is that since we check if details is truthy and possessing non-zero length, it could be a string and an array. And later we try to use the reduce function, which only works on arrays, so if it's a string, the UI crashes.\r\n\r\n`const hasDetails = details && details.length !== 0;`\r\n`errorMsg = details.reduce(function(memo, error) {...`\r\n\r\n## Dependencies\r\nNone.\r\n\r\n## Screenshots\r\nNone.\r\n"},"comment":{"url":"https://api.github.com/repos/dcos/dcos-ui/issues/comments/507431086","html_url":"https://github.com/dcos/dcos-ui/pull/3956#issuecomment-507431086","issue_url":"https://api.github.com/repos/dcos/dcos-ui/issues/3956","id":507431086,"node_id":"MDEyOklzc3VlQ29tbWVudDUwNzQzMTA4Ng==","user":{"login":"mesosphere-ci","id":16123494,"node_id":"MDQ6VXNlcjE2MTIzNDk0","avatar_url":"https://avatars0.githubusercontent.com/u/16123494?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere-ci","html_url":"https://github.com/mesosphere-ci","followers_url":"https://api.github.com/users/mesosphere-ci/followers","following_url":"https://api.github.com/users/mesosphere-ci/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere-ci/subscriptions","organizations_url":"https://api.github.com/users/mesosphere-ci/orgs","repos_url":"https://api.github.com/users/mesosphere-ci/repos","events_url":"https://api.github.com/users/mesosphere-ci/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere-ci/received_events","type":"User","site_admin":false},"created_at":"2019-07-01T21:23:28Z","updated_at":"2019-07-01T21:23:28Z","author_association":"COLLABORATOR","body":":tada: This PR is included in version 2.114.4 :tada:\n\nThe release is available on [GitHub release](https://github.com/dcos/dcos-ui/releases/tag/master%2Bv2.114.4)\n\nYour **[semantic-release](https://github.com/semantic-release/semantic-release)** bot :package::rocket:"}}
{"actor":{"display_login":"mesosphere-ci"}}