Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Gitlab 9.1 TypeError: Cannot read property 'base_sha' of #1063

Closed
iShawnWang opened this issue Aug 29, 2020 · 2 comments
Closed

[BUG] Gitlab 9.1 TypeError: Cannot read property 'base_sha' of #1063

iShawnWang opened this issue Aug 29, 2020 · 2 comments
Labels

Comments

@iShawnWang
Copy link
Contributor

iShawnWang commented Aug 29, 2020

Describe the bug

npm run danger:ci

> afl@1.0.1 danger:ci /Users/ishawnwang/ironman
> DANGER_GITLAB_API_BASE_URL=http://code.XXX.com/api/v4 DANGER_GITLAB_HOST=http://code.XXX.com/ DANGER_GITLAB_API_TOKEN=<TOKEN> danger pr http://code.XXX.com/lhs/ironman/merge_requests/1558

Starting Danger PR on lhs/ironman#1558
Error:  TypeError: Cannot read property 'base_sha' of
    at Object.exports.gitLabGitDSL (/Users/ishawnwang/ironman/node_modules/danger/distribution/platforms/gitlab/GitLabGit.js:45:38)
    at Object.<anonymous> (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:91:39)
    at step (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:32:23)
    at Object.next (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:13:53)
    at /Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:3:12)
    at Object.exports.jsonToDSL (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:64:53)
    at Object.<anonymous> (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToContext.js:55:54)
    at step (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToContext.js:32:23)

TypeError: Cannot read property 'markdowns' of undefined
    at /Users/ishawnwang/ironman/node_modules/danger/distribution/commands/danger-runner.js:119:27
    at /Users/ishawnwang/ironman/node_modules/node-cleanup/node-cleanup.js:80:9
    at Array.forEach (<anonymous>)
    at process.exitHandler (/Users/ishawnwang/ironman/node_modules/node-cleanup/node-cleanup.js:79:21)
    at process.emit (events.js:315:20)

Error:  TypeError: Cannot read property 'base_sha' of undefined
    at Object.exports.gitLabGitDSL (/Users/ishawnwang/ironman/node_modules/danger/distribution/platforms/gitlab/GitLabGit.js:45:38)
    at Object.<anonymous> (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:91:39)
    at step (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:32:23)
    at Object.next (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:13:53)
    at /Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:3:12)
    at Object.exports.jsonToDSL (/Users/ishawnwang/ironman/node_modules/danger/distribution/runner/jsonToDSL.js:64:53)
    at Object.<anonymous> (/Users/ishawnwang/ironman/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:162:54)
    at step (/Users/ishawnwang/ironman/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:43:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! afl@1.0.1 danger:ci: `DANGER_GITLAB_API_BASE_URL=http://code.XXX.com/api/v4 DANGER_GITLAB_HOST=http://code.XXX.com/ DANGER_GITLAB_API_TOKEN=<TOKEN> danger pr http://code.XXX.com/lhs/ironman/merge_requests/1558`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the afl@1.0.1 danger:ci script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ishawnwang/.npm/_logs/2020-08-29T01_32_01_302Z-debug.log

To Reproduce
Steps to reproduce the behavior:

  1. setup danger ci follow getting startted guide
  2. npm run danger pr

Expected behavior

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

** Your Environment**

software version
danger.js 10.4.0
node 12.17.0
npm 6.14.7
Operating System macos
gitlab GitLab Community Edition 9.1.4 fed799a

Additional context

Found related issue #855 (comment) but still not work now

@iShawnWang iShawnWang added the bug label Aug 29, 2020
@iShawnWang iShawnWang changed the title [BUG] [BUG] Gitlab 9.1 TypeError: Cannot read property 'base_sha' of Aug 29, 2020
@iShawnWang
Copy link
Contributor Author

iShawnWang commented Aug 29, 2020

After simple debugging, i found that there is no diff_refs.base_sha property in the response

console.log(JSON.stringify(gitlab.mr, null, 4))

{
    "id": 72212,
    "iid": 1558,
    "project_id": 2027,
    "title": "Feat/XXX",
    "description": "",
    "state": "merged",
    "created_at": "2020-08-27T13:01:36.871Z",
    "updated_at": "2020-08-27T13:01:39.850Z",
    "target_branch": "master",
    "source_branch": "feat/XXX",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
        "name": "Shuai Wang",
        "username": "iShawnWang",
        "id": 451,
        "state": "active",
        "avatar_url": "http://code.XXX.com/uploads/user/avatar/451/avatar.png",
        "web_url": "http://code.XXX.com/iShawnWang"
    },
    "assignee": null,
    "source_project_id": 2027,
    "target_project_id": 2027,
    "labels": [],
    "work_in_progress": false,
    "milestone": null,
    "merge_when_pipeline_succeeds": false,
    "merge_status": "can_be_merged",
    "sha": "f8106c8f77623c594095c8ee3516138b5fb3d65f",
    "merge_commit_sha": "1a3ce1cf81717d21b348ca7119624ffaae91f688",
    "user_notes_count": 0,
    "should_remove_source_branch": null,
    "force_remove_source_branch": true,
    "web_url": "http://code.XXX.com/lhs/ironman/merge_requests/1558",
    "subscribed": true
}

@iShawnWang
Copy link
Contributor Author

iShawnWang commented Aug 29, 2020

It working as expected now ~
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant