Resolve "API issue state endpoint returning 500 errors"
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
- Update to
gitter-markdown-processor@18
which correctly parses GitLab issue links - Translate
HTTPError
s coming from the GitLab Issuable Service toStatusError
s (so that non-existent project URL results in404
rather than500
- 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.
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
/-
)
- 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
- Inspect the message HTML and see the correct
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