Skip to content

Issue type change to incident results in 404

Problem

@gerardo reported the following:

Hi team. A customer reported ( and I replicated) that on gitlab.com when they create an issue, and later on you try to change it to an Incident you get a 404 now, and the url shows /issue/incident/<id> . I tested this on older version of gitlab, 15.11 and as expected it works. Has anyone seen this? or know if this is a know bug?

I tested this on my local and I can reproduce the behaviour.

Investigation

We have the route:

$ rails routes -T | grep incident 

shows that we do have issues/incident/123 as a route ...

incident_namespace_project_issues GET                   /*namespace_id/:project_id/-/issues/incident/:id(/:incident_tab)(.:format)                                                               projects/incidents#show

However, I also noticed on my local that the issue type was never updated.

Looks like incident is no longer an allowed type for work items 👉 https://gitlab.com/gitlab-org/gitlab/-/blob/6c411207d6d2faf51266291856ce4a721bba7352/app/controllers/projects/issues_controller.rb#L420

So I think what's happening is that the incident type is being stripped out of the params before it hits the update bit, so it doesn't actually update the type. But it still updates everything else, such as issue metrics, and return a 200, and the frontend sees a success message so it forwards to the incident URL, but the issue isn't an incident, resulting in a 404.

To reproduce

  1. create a new issue in a project
  2. edit the issue and select "incident"
  3. save. The page refreshes as 404 with a URL of <project_path>/-/issues/incident/iid

Workaround

GraphQL API can be used to update the incident 👉 #418983 (comment 1475066068)

Further reading

https://docs.gitlab.com/ee/development/issue_types.html

Edited by charlie ablett