Skip to content

module depends on deprecated "request" which has issues with certs #64

@Giszmo

Description

@Giszmo

My BTCPayServer is using a letsencrypt cert which is affected by this issue. As explained in the link, the browser has no issue with expired certs but my api call fails.

$ node
> const key = "redacted"
> const btcpay = require('btcpay')
> const keypair = btcpay.crypto.load_keypair(new Buffer.from(key, 'hex'))
> const client = new btcpay.BTCPayClient("https://pos.btcpay.nz", keypair, {merchant: 'redacted'})
> client.get_invoices({status: "complete"}).then( invoices => {})
Promise { <pending> }
> (node:2032689) UnhandledPromiseRejectionWarning: RequestError: Error: certificate has expired
    at new RequestError (/path/to/project/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/path/to/project/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/path/to/project/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/path/to/project/node_modules/request/request.js:185:22)
    at Request.emit (events.js:193:13)
    at Request.EventEmitter.emit (domain.js:481:20)
    at Request.onRequestError (/path/to/project/node_modules/request/request.js:877:8)
    at ClientRequest.emit (events.js:193:13)
    at ClientRequest.EventEmitter.emit (domain.js:481:20)
    at TLSSocket.socketErrorListener (_http_client.js:397:9)
    at TLSSocket.emit (events.js:193:13)
    at TLSSocket.EventEmitter.emit (domain.js:481:20)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
(node:2032689) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2032689) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

As the crash is caused in btcpay.BTCPayClient, I suspect this should be fixed in this project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions