ndaversa / hubot-jira-bot

Lets you search for JIRA tickets, open them, transition them thru different states, comment on them, rank them up or down, start or stop watching them or change who is assigned to a ticket. Also, notifications for assignments, mentions and watched tickets.
https://www.npmjs.com/package/hubot-jira-bot
MIT License
61 stars 43 forks source link

reason: self signed certificate in certificate chain #35

Closed mchennamsetty closed 7 years ago

mchennamsetty commented 7 years ago

Friends,

Currently I am having a difficulty to resolve the following issues. I have spent considerable amount of time to find information around this issue. Tried number of options.

Ex: npm config set strict-ssl false -g npm config set cafile C:/Users/{Path}.{File Name}.pem npm config set NODE_TLS_REJECT_UNAUTHORIZED=0 -g npm config set ca="" npm config set ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"

Any additional inputs are greatly appreciated.

C:\Users\xxx\WORK\DevOps\ChatOps\wrkspace\apprel>.\bin\hubot --adapter slack [Mon May 22 2017 08:37:08 GMT-0500 (Central Daylight Time)] DEBUG Loading adapter slack [Mon May 22 2017 08:37:09 GMT-0500 (Central Daylight Time)] INFO Logged in as devops of DevOps [Mon May 22 2017 08:37:10 GMT-0500 (Central Daylight Time)] INFO Slack client now connected [Mon May 22 2017 08:37:45 GMT-0500 (Central Daylight Time)] DEBUG Executing listener callback for Message 'devops jira search APF-3' `` [Mon May 22 2017 08:37:45 GMT-0500 (Central Daylight Time)] DEBUG Fetching: https://jira.xxx.com/jira/rest/api/2/search [Mon May 22 2017 08:37:45 GMT-0500 (Central Daylight Time)] ERROR { FetchError: request to https://jira.xxx.com/jira/rest/api/2/search failed, reason: self signed certificate in certificate chain at ClientRequest. (C:\Users\xxx\WORK\DevOps\ChatOps\wrkspace\apprel\node_modules\node-fetch\index.js:133:11) at emitOne (events.js:96:13) at ClientRequest.emit (events.js:188:7) at TLSSocket.socketErrorListener (_http_client.js:309:9) at emitOne (events.js:96:13) at TLSSocket.emit (events.js:188:7) at emitErrorNT (net.js:1281:8) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9)

name: 'FetchError', message: 'request to https://jira.xxx.com/jira/rest/api/2/search failed, reason: self signed certificate in certificate chain', type: 'system', errno: 'SELF_SIGNED_CERT_IN_CHAIN', code: 'SELF_SIGNED_CERT_IN_CHAIN' } ``

mchennamsetty commented 7 years ago

Was able to resolve it by adding httpsAgentOptions = {rejectUnauthorized: false } httpsAgent = new https.Agent(httpsAgentOptions)