mdsb100 / cli-gitlab

GitLab CLI library
101 stars 11 forks source link

createIssue / editIssue just return true #9

Closed alerque closed 8 years ago

alerque commented 8 years ago

I've recently setup cli-gitlab including setting the URL and adding a token. This seems to work for read operations, but I can't seem to make it actually do anything, nor does it give me any indication of what went wrong:

❯❯❯ gitlab createIssue -t "Test from CLI" 16
true

I expected a json representation of the created issue. No issue is created and "true" seems like a misnomer.

Project id 16 is a test repo I setup for playing with this, and if I query it I can see the existing issues:

❯❯❯ gitlab issues --filter item.project_id==16
[
  {
     ...
  }
  ...
]

Likewise editIssue just returns "true" to the console and doesn't actually edit anything.

mdsb100 commented 8 years ago

Let me test. I will publish fix version as soon as possible.I hope this is not node-gitlab issue.

alerque commented 8 years ago

Thanks! I'm on Gitlab 8.11.3 if that is relevant. My Gitlab Unicorn service is also running behind an Apache proxy but I think I have the settings for that worked out pretty well. Other things (such as the Labcoat Android app, Leanlabs' Kanban board, etc.) are able to use the API to create and edit issues just fine through the proxy.

mdsb100 commented 8 years ago

@alerque Work fine for me, I test it by using "https://gitlab.com/"

See picture: fea9639d-b777-454b-882d-808ff1a494d5 8e0dff8e-fd5f-4420-94de-6f6a05a5bfdc 3f4cda91-fb27-4f9a-b223-e930ea87a5fd cdfa876c-c0bc-4067-9023-7783a0a031dd 36a38c97-7b10-4b6f-bc5a-e6b85051c7c2

Please do this:

sudo npm uninstall -g node-gitlab
sudo npm install -g cli-gitlab

Test it again, and tell me the version. Both them.

alerque commented 8 years ago

I did some more testing including a re-install and finally came up with the root of the problem: SSL.

More specifically, the proxy my Gitlab instance is behind is HTTPS only. If you hit it up on HTTP it just redirects you to HTTPS. I had accidentally set the URL using gitlab url http://.... Confusing this works for some API calls. Whatever is going on under the hood it was properly following redirects, but for some calls it was failing. If I had to guess I'd say the GET requests were working and the POSTS were failing.

Setting the URL to gitlab url https://... works, but something should probably be done to help future users. Maybe a warning should be thrown whet GET requests are redirected so the user is prompted to fix their URL.

mdsb100 commented 8 years ago

OK, I understand. I will remind user when they call command 'gitlab url' and update README.md. Thank you 👍 Close it.