How to Promisify this function – nodejs [duplicate]
You have the error because create() is not a Promise. Promisifying an async function is quite easy (nodejs has a built-in Promise support nowadays): function createTicket(ticket) { // 1 – Create a new Promise return new Promise(function (resolve, reject) { // 2 – Copy-paste your code inside this function client.tickets.create(ticket, function (err, req, result) { … Read more