Deleted Channel causes Project Overview screen to crash

kkelchen's Avatar

kkelchen

06 Jan, 2018 07:27 PM

Octopus Server Version Number: 4.1.1

Hello!

We're receiving an unhandled JS error on the Project Overview screen when there is a historical deployment to display from a Release that uses a deleted Channel and the Project has more than 1 Channel.

Steps to Reproduce

  1. Have a Project with 2 Channels
  2. Create a Release using a Channel and deploy to an Environment that would appear on the Project Overview screen and therefore display the result of the deployment you're running
  3. After the deployment, change the Channel on the Release
  4. Delete the Channel that was originally used in the Release/Deployment
  5. Add a Channel to the Project so that you have more than 1 Channel again
  6. View the Project Overview screen. Boom.

An image of the error in the UI is attached.

The error message is:

An unexpected error occurred in a React component: "TypeError: Cannot read property 'Name' of undefined"

The full exception is:

TypeError: Cannot read property 'Name' of undefined
    at t.renderTaskStatusCell (https://octopus.cartegraph.com/main.7d16458c40ecd20a3187.hashedasset.js:1:759876)
    at t.render (https://octopus.cartegraph.com/main.7d16458c40ecd20a3187.hashedasset.js:1:757832)
    at u (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:287981)
    at beginWork (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:289481)
    at i (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:301773)
    at u (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:302289)
    at c (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:302764)
    at m (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:304786)
    at h (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:304295)
    at Object.enqueueSetState (https://octopus.cartegraph.com/react.5df53a8b940aa4e97248.hashedasset.js:1:285562)

The Server Log does not show anything related to the error.

Since the Overview screen is the landing page when navigating to a Project, this was a bigger issue for us, so I investigated to learn more and then employed an unideal workaround so we could keep using more than 1 Channel with the affected Environments displaying on the Overview screen.

In /app/areas/projects/components/ProjectDashboard/DashboardCell/DashboardCell.tsx in renderTaskStatusCell(), we see the following:

const channel = Object.keys(cube.projectIndex).length === 1 && Object.keys(cube.channelIndex).length > 1 ?
            cube.channelIndex[visibleDeploymentItem.ChannelId].Name :
            undefined;

When you have more than 1 Channel (Object.keys(cube.channelIndex).length > 1) it executes cube.channelIndex[visibleDeploymentItem.ChannelId].Name. When a Deployment is trying to display that uses a deleted Channel, visibleDeploymentItem.ChannelId references the deleted Channel. However, cube.channelIndex doesn't contain that Channel. So when the .Name is accessed it's doing so on a value of undefined. At least that's what I could tell (thank you for shipping source maps!).

My workaround was to using the Octopus REST API to delete all Deployments for the Project that appear on the Overview screen that were associated with a deleted Channel. Unfortunately we lost that historical information about which Environment/Deployment Target had received which Release. Fortunately, such history for this specific Project of ours is more of a minor thing, and the Project Overview screen is now working again with more than 1 Channel.

Thank you for all the hard work and for creating such a great product!

Kevin

  1. Support Staff 1 Posted by Reece Walsh on 09 Jan, 2018 04:38 AM

    Reece Walsh's Avatar

    Hi Kevin,

    Thanks for getting in touch,

    I'm sorry to hear you are experiencing this issue, I do, however, greatly appreciate the time you have taken to document the replication steps it really helps out!

    I've been able to replicate this same issue on Octopus Version 4.1.6 at this stage, I've created a GitHub issue that you can find below;

    https://github.com/OctopusDeploy/Issues/issues/4152

    You can keep up to date with the current progress of this issue via the aforementioned URL.

    I've found that upon release creation & deployment of the subsequent release the overview screen returned to normal functionality. Sorry for any inconvenience caused as a result in the interim.

    If you need any further assistance or clarification please let me know :)

    Kind Regards,

    Reece

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • DeletedChannel.PNG 36.4 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac