Skip to content

Resolve "API issue state endpoint returning 500 errors"

Tomas Vik requested to merge 2453-fix-issue-endpoint-500 into develop

Closes #2453 (closed)

This MR has got 3 commits that equivalent to the 3 fixes from the issue description: https://gitlab.com/gitlab-org/gitter/webapp/-/issues/2453#the-fix

  1. Update to gitter-markdown-processor@18 which correctly parses GitLab issue links
  2. Translate HTTPErrors coming from the GitLab Issuable Service to StatusErrors (so that non-existent project URL results in 404 rather than 500
  3. Temporarily remove the trailing /- from markdown parsed repos

Testing strategy

Before checking out this MR

This step simulates the current production. Paste the following links anywhere in your local Gitter as separate messages:

  • https://gitlab.com/gitlab-org/gitter/webapp/-/issues/2453
  • https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1816

Observe the issue-state endpoint returning 500 and the issue decoration not happening.

Screenshot_2020-04-07_at_12.39.31_PM

Inspect the message HTML and see the incorrect data-issue-repo="gitlab-org/gitter/webapp/-" attribute

Run

curl -H "Authorization: Bearer <token>" "localhost:5000/api/private/issue-state?t=issue&p=gitlab&r=gitlab-org%2Fgitter%2Fwebapp%2F-&i=2472"

And see the response having status 500.

Checkout this MR

  • update the markdown processor dependency npm i
  • start the webapp npm start
  • refresh the room with messages created in the "Before checking out this MR" section
    • see the issues being decorated correctly (although the link text still contains the /-)
  • paste the same messages as in the "Before checking out this MR" section
    • Inspect the message HTML and see the correct data-issue-repo="gitlab-org/gitter/webapp" attribute
    • Se the correct decoration happening

Screenshot_2020-04-07_at_12.33.19_PM

Run

curl -H "Authorization: Bearer <token>" "localhost:5000/api/private/issue-state?t=issue&p=gitlab&r=gitlab-org%2Fgitter%2Fwebapp%2F-&i=2472"

And see the response having status 404.

Edited by Tomas Vik

Merge request reports