RamonGebben/mergify

Configure fails when running against an instance with a self-signed certificate

jlengrand opened this issue · 2 comments

This is what I get when I try to configure my work gitlab. I get certificate issues

[jlengrand@rn07t1c18:~/IdeaProjects/mergify]$ node index.js -c
? What is your Gitlab User ID? 6011
? What private token shall we use? [hidden]
? On what domain is your Gitlab instance? gitlab.company.net

🙀  Oh no, could not complete verify. Please review your config
{ FetchError: request to https://gitlab.company.net/api/v4/users/6011 failed, reason: unable to verify the first certificate
    at ClientRequest.<anonymous> (/Users/jlengrand/IdeaProjects/mergify/node_modules/node-fetch/lib/index.js:1393:11)
    at ClientRequest.emit (events.js:180:13)
    at TLSSocket.socketErrorListener (_http_client.js:395:9)
    at TLSSocket.emit (events.js:180:13)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at process._tickCallback (internal/process/next_tick.js:178:19)
  message: 'request to https://gitlab.company.net/api/v4/users/6011 failed, reason: unable to verify the first certificate',
  type: 'system',
  errno: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }

So it looks like at the moment I can't use mergify at work. I'll look into that too.

As @RamonGebben mentioned, it looks like adding the following line in the index fixes the issue:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

You can read more about this here.

We should probably put this behind a flag for people to be able to use mergify for instances with self-signed certificates.