I am getting a returnValue from get_tlsCert.js, assigning to cert64. Now I want to use that cert64 in the lnd object below and export the lnd object. However, when I am calling this file to retrieve the lnd object exported value, I am getting an error.
How do I export lnd, please?
[UnhandledPromiseRejection: 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(). The promise rejected with the reason "[object Array]".] { code: 'ERR_UNHANDLED_REJECTION' }
const lnService = require('ln-service');
const certFile = require('./get_tlsCert.js');
let cert64;
certFile().then(function(returnValue){
cert64 = returnValue;
});
const {lnd} = lnService.authenticatedLndGrpc({
cert: cert64,
macaroon: '123456789',
socket: '123456789',
});
module.exports.lnd = lnd;