vishwanatharondekar / gitlab-cli

Create a merge request from command line in gitlab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when I try to make merge request

SilentImp opened this issue · comments

When I try to make merge request:

$ gitlab-cli create-merge-request -b feature/GAS-1179/roundRatings -t release/1.0.0
/usr/local/lib/node_modules/gitlab-cli/index.js:358
          var defaultBranch = project.default_branch;
                                     ^

TypeError: Cannot read property 'default_branch' of null
    at /usr/local/lib/node_modules/gitlab-cli/index.js:358:38
    at /usr/local/lib/node_modules/gitlab-cli/node_modules/gitlab/lib/Models/Projects.js:139:20
    at /usr/local/lib/node_modules/gitlab-cli/node_modules/gitlab/lib/ApiBaseHTTP.js:86:22
    at Function._Class.wrap_response (/usr/local/lib/node_modules/gitlab-cli/node_modules/slumber/lib/API.js:192:18)
    at Function.wrap_response (/usr/local/lib/node_modules/gitlab-cli/node_modules/slumber/lib/API.js:4:59)
    at Request._callback (/usr/local/lib/node_modules/gitlab-cli/node_modules/slumber/lib/API.js:215:26)
    at Request.self.callback (/usr/local/lib/node_modules/gitlab-cli/node_modules/request/request.js:188:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/gitlab-cli/node_modules/request/request.js:1171:10)

Fetching of project information failed. At first look I'll want you to verify your GITLAB_URL for http and https discrepancy.

GITLAB_URL=http://gitlab.com
it's just gitlab

$ echo $GITLAB_URL
http://gitlab.com

@SilentImp
Can you try with

GITLAB_URL=https://gitlab.com

note the change of https

@SilentImp any chance on getting this checked.

@SilentImp I will assume that this problem is fixed and close this. Feel free to reopen if you are still facing the issue.

I am having the exact same problem. I have GITLAB_URL=https://gitlab.com though...
It was working before, and I suddenly get this.

If it was working before, can you check if you are able to connect to gitlab.com through your network as expected.

Yes, I can. Other git command on gitlab repo also work as expected. Might gitlab have changed their API?

Here is the full stacktrace

/Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/index.js:409
          var defaultBranch = project.default_branch;
                                      ^

TypeError: Cannot read property 'default_branch' of null
    at /Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/index.js:409:39
    at /Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/node_modules/gitlab/lib/Models/Projects.js:145:20
    at /Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/node_modules/gitlab/lib/ApiBaseHTTP.js:86:22
    at Function._Class.wrap_response (/Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/node_modules/slumber/lib/API.js:192:18)
    at Function.wrap_response (/Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/node_modules/slumber/lib/API.js:4:59)
    at Request._callback (/Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/node_modules/slumber/lib/API.js:215:26)
    at Request.self.callback (/Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/node_modules/request/request.js:186:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/Users/xxx/.nvm/versions/node/v8.9.2/lib/node_modules/git-lab-cli/node_modules/request/request.js:1163:10)

Possible. I have been using this with our hosted solution with version 10.1.4-ee and works fine.
I see that gitlab.com is on version 11.0.0-rc11-ee.

Will put some time to check creating MR on gitlab.com directly and update here.

Any news?

I did check this last weekend. I was able to reproduce this on gitlab.com. Seems like some API has changed in gitlab 11. I checked if this is a known issue in node gitlab I'm using, but couldn't find it.
I will check this again in detail, probably have to replace node gitlab with my own http request to make this work. This might take time.

I checked this yesterday. Found out that main dependent package I'm using node-gitlab is not maintained by original author anymore. He has given away the npm package to some other user. I checked the new node-gitlab. Will need some changes to incorporate that. I did try integrating this new node gitlab yesterday and it did make it work for gitlab.com repo.
Unfortunately it's not working for my organisation gitlab instance repo. I'm getting https connection error. I'm looking into this more. You will have to wait. I can give you half baked branch if you are interested in installing from that.
PS: This comment was made from phone. Will add references later.

That's a shame...
I would be glad to get your half baked branch because your lib definitely help a lot when making merge requests, but if it's to much trouble, I can wait.

Any updates ?

Thanks @qkdreyer . I see you have taken matter into your hands and have created the MR. Looking into it right now. I had created one branch for gitlab 11, I will share it here anyway.

If you want to use the branch, install it like following

npm i -g https://github.com/vishwanatharondekar/gitlab-cli.git#gitlab-11

cc: @Sharcoux

Looks like the error I am seeing on our gitlab instance is maybe due to misconfigured https. Will be great if someone not on gitlab 11 confirm that this is working for them then I can merge #59 which fixes this.

Youhou!
Thanks for your work! That works fine now :)