danger / danger/danger-js

[BUG] Not Found error when running danger with GitLab CE without MR approvals API

Open
#1,106 11 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
5.5k
Forks
379
Avg merge
2h 8m
Merged PRs (30d)
6

Description

**Describe the bug**
Our builds have started failing with the following error since using v10.6.2:
```
Error: { HTTPError: Not Found
at fn (/root/.npm/_npx/15/lib/node_modules/danger/node_modules/ky/umd.js:266:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'HTTPError',
response:
Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]:
{ url:
'https://$GITLAB/api/v4/projects/$PROJECT/merge_requests/579/approvals',
status: 404,
statusText: 'Not Found',
headers: [Headers],
counter: 0 } },
description: '404 Not Found' }
```

**To Reproduce**
Steps to reproduce the behavior:
1. Execute danger with selfhosted GitLab CE without MR approvals API (for example 12.8.6)
2. Above error will occur

**Expected behavior**

Danger shouldn't fail, either by allowing the user to configure skipping using this approvals API or ignoring the error and carrying on without these API results. Or maybe there is a more elegant solution that I am not thinking of at the moment.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Your Environment**

| software | version
| ---------------- | -------
| danger.js | 10.6.2
| node | 10.23.2
| Operating System | swift:5.2 docker image (Ubuntu 18.04)
| Gitlab | GitLab Community Edition 12.8.6

**Additional context**
Also according to https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals this API will be moved to GitLab Premium only in 13.9, so expecting the API to exist/work might become problematic then as well.
Probably introduced in #1098.

Contributor guide

Open the contributing guide

Research direction

Trace the GitLab merge request approvals request described in the report, especially the change introduced in #1098, and reproduce it against GitLab CE 12.8.6. Determine how a missing approvals endpoint should be handled, then verify that Danger continues without failing while preserving behavior when the API is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
gitlab, node.js, typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.