Last active
October 4, 2017 10:01
-
-
Save Timboo89/fc9bccb29d6a0a605e73ee5d1f710be1 to your computer and use it in GitHub Desktop.
createJiraTicket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: uncaughtException: socket hang up date=Wed Oct 04 2017 11:42:04 GMT+0200 (CEST), pid=17245, uid=505, gid=20, cwd=/Users/XXX/source, execPath=/usr/local/Cellar/node/8.2.1/bin/node, version=v8.2.1, argv=[/usr/local/Cellar/node/8.2.1/bin/node, /usr/local/bin/lambda-local, -l, ./index.js, -h, ticketCreate, -e, event-samples/event.js, -E, {"FEED_URL":"https://aws.amazon.com/security/security-bulletins/feed/","FEED_HTML_URL":"https://aws.amazon.com/security/security-bulletins/","VERBOSE":"true","DEBUG":"true","MAX_MINUTES":"60","JIRA_HOST":"https://xxx.atlassian.net","JIRA_USER":"x@example.com","JIRA_PW":"XXX","JIRA_PROJECT":"TEST","JIRA_ISSUE_TYPE":"Bug"}, -t, 60], rss=84918272, heapTotal=62926848, heapUsed=33087960, external=320602, loadavg=[1.79638671875, 2.08935546875, 2.150390625], uptime=9849, trace=[column=15, file=_http_client.js, function=createHangUpError, line=345, method=null, native=false, column=23, file=_http_client.js, function=Socket.socketOnEnd, line=437, method=socketOnEnd, native=false, column=20, file=events.js, function=emitNone, line=110, method=null, native=false, column=7, file=events.js, function=Socket.emit, line=207, method=emit, native=false, column=12, file=_stream_readable.js, function=endReadableNT, line=1045, method=null, native=false, column=11, file=internal/process/next_tick.js, function=_combinedTickCallback, line=138, method=null, native=false, column=9, file=internal/process/next_tick.js, function=process._tickDomainCallback, line=218, method=_tickDomainCallback, native=false], stack=[Error: socket hang up, at createHangUpError (_http_client.js:345:15), at Socket.socketOnEnd (_http_client.js:437:23), at emitNone (events.js:110:20), at Socket.emit (events.js:207:7), at endReadableNT (_stream_readable.js:1045:12), at _combinedTickCallback (internal/process/next_tick.js:138:11), at process._tickDomainCallback (internal/process/next_tick.js:218:9)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _JIRA_PROJECT = "TEST"; | |
const _JIRA_ISSUE_TYPE = "Bug"; | |
const _JIRA_USER = "XXX"; | |
const _JIRA_PW = "XXX"; | |
const _JIRA_HOST = "https://xxx.atlassian.net"; | |
var createJiraTicket = (url, title, summary, priority, callback) => { | |
var data = { | |
"fields": { | |
"project": { | |
"key": _JIRA_PROJECT | |
}, | |
"summary": title, | |
"description": summary, | |
"issuetype": { | |
"name": _JIRA_ISSUE_TYPE | |
}, | |
"priority": { | |
"name": priority | |
} | |
} | |
}; | |
var login_data = querystring.stringify({ | |
username: _JIRA_USER, | |
password: _JIRA_PW | |
}); | |
var options = { | |
host: _JIRA_HOST, | |
port: 80, | |
path: '/rest/api/2/issue/', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Content-Length': Buffer.byteLength(login_data) | |
} | |
}; | |
var req = http.request(options, function(res) { | |
res.setEncoding('utf8'); | |
res.on('data', function (chunk) { | |
console.log("body: " + chunk); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment