ahungry / org-jira

Bring Jira and OrgMode together
680 stars 130 forks source link

request--curl-callback: event exited abnormally with code 3 #331

Closed igajsin closed 1 year ago

igajsin commented 1 year ago

Hi, first of all thanks for the project, it should be very useful when I'll manage to make it working, but now for the very basic setup

(use-package org-jira
  :ensure t
  :custom
  (jiralib-url "https:jira.company.com")
  (org-jira-working-dir "~/gtd/jira"))

I've got the error

I was called, was it with a callback? yes
[debug] request--curl: --silent --location --cookie ~/.emacs.d/request/curl-cookie-jar --cookie-jar ~/.emacs.d/request/curl-cookie-jar --include --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --compressed --request POST --header Authorization: Basic aValidBase64== --header Content-Type: application/json --url https:jira.company.com/rest/api/2/search --data-binary @-
Fetching issues...
[debug] request--curl-callback: event exited abnormally with code 3

[trace] request--curl-callback: raw-bytes=

(:num-redirects 0 :url-effective "https:jira.company.com/rest/api/2/search")
[debug] request--callback: UNPARSED

(:num-redirects 0 :url-effective "https:jira.company.com/rest/api/2/search")
[trace] request--cut-header: cutting
 [2 times]
[trace] request--parse-data: (:num-redirects 0 :url-effective "https:jira.company.com/rest/api/2/search")
[error] request--callback: peculiar error
[debug] request--callback: executing error

"JIRA_ERROR - see your *Messages* buffer for more details."

"JIRA_ERROR REQUEST: "

"/rest/api/2/search"

(:type "POST" :data "{\"jql\":\"assignee = currentUser() and resolution = unresolved ORDER BY\\n  priority DESC, created ASC\",\"maxResults\":100}")

"JIRA_ERROR RESPONSE: "

nil

progn: JIRA_ERROR - see your *Messages* buffer for more details.

For obvious reason authorization header, url and file paths were masked here. I've tried to run the command above directly via cli and (if replace --data-binary @= to --data-binary '{}'), the curl works well, at least the jira sends me huge json without complains. Any idea how I can continue?

ahungry commented 1 year ago

I quickly grepped request.el and org-jira - I don't see a match for"abnormal", so this may be more of a lower level/curl specific problem.

An invalid URL can trigger an exit code 3 with curl:

❯ curl 'http:example.com'
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
❯ echo $?
3

If the "abnormal" message is just Emacs relaying the shell out to curl's error code, maybe the URL you have configured isn't valid?

I notice you have https:jira.company.com, which I assume was a result of obfuscating your sensitive data (thank you btw, always stressful to see people paste their base64 credentials) - please confirm the actual error log shows the equivalent of https://jira.company.com (note the //).

A more primitive request might be to try a manual (request call (see: C-h f request for details) to your URL, and also to (or compare manually) with jiralib-url - see if that triggers the same error?

igajsin commented 1 year ago

Shame on me, that was a typo in the jiralib-url, somehow https://jira.company.com was copied to https:jira.company.com. Sorry about that.