etsy / 411

An Alert Management Web Application
https://demo.fouroneone.io
MIT License
969 stars 112 forks source link

Send to Jira fails #58

Closed AGirin closed 7 years ago

AGirin commented 7 years ago

I tried Jira functionality and I can see my projects and tasks but when I click send I just get an error - failed to send Alert. Not errors in the log files.

kiwiz commented 7 years ago

Do you get a 'Remote server returned' error?

AGirin commented 7 years ago

image

This is what I see.

kiwiz commented 7 years ago

Can you try again after pulling? I changed up the logging a bit.

AGirin commented 7 years ago

Did that. Got Error 400 now.

kiwiz commented 7 years ago

One more time. You should get the actual body that JIRA is returning in the error msg.

AGirin commented 7 years ago

Go this now:

image

And I see this error in the log:

except [NONE] Errno 4096: "Object of class stdClass could not be converted to string" at [/var/www/411/phplib/Target/Jira.php:78] 0:[sprintf() called at [/var/www/411/phplib/Target/Jira.php:78]] 1:[FOO\Jira_Target::createIssue() called at [/var/www/411/phplib/Target/Jira.php:52]] 2:[FOO\Jira_Target->process() called at [/var/www/411/phplib/REST/Alerts.php:214]] 3:[FOO\Alerts_REST->sendAlerts() called at [/var/www/411/phplib/REST/Alerts.php:83]] 4:[FOO\Alerts_REST->POST() called at [/var/www/411/phplib/REST.php:108]] 5:[FOO\REST->route() called at [/var/www/411/htdocs/api/alerts.php:6]], referer: http://test.test.com/alerts?query=state:(0+1)

kiwiz commented 7 years ago

Oh, looks like it's returning an object. Can you add a print_r around line 76 in Target/Jira.php?

AGirin commented 7 years ago

I think I am doing something wrong. Does this look like what you wanted?

print_r; if($curl->httpStatusCode < 200 || $curl->httpStatusCode >= 300) { throw new TargetException(sprintf('Remote server returned %d: %s: %s', $curl->httpStatusCode, $curl->httpErrorMessage, $ret)); }

kiwiz commented 7 years ago

print_r($ret);, rather.

AGirin commented 7 years ago

Yea, I tried that already and nothing new in the logs.

This is what I got with tcpdump:

image

AGirin commented 7 years ago

Ok, I got it to work. First I must have assignee specified and second - actually specify the right assignee. I forgot that our Jira uses AD usernames and I was specifying the wrong one.

Not sure if this makes sense but maybe assignee must be require field?

kiwiz commented 7 years ago

I think it might depend on your JIRA project's config. We could probably load the full list of users via https://JIRA/rest/api/latest/user/search?username=%&maxResults=10000. Not sure if it's worth the request.

AGirin commented 7 years ago

That would be great I think. At least it would help us a lot.

AGirin commented 7 years ago

https://github.com/etsy/411/issues/50 --> Just want to make sure you saw my last question. I could not find any references to https in templates. Jira ticket has a link to the issue but it is also https. I can fix this on my side but where exactly is this base_url?