How to call imported function in promise chain when connecting to SQL

I am trying to write a function to log data to SQL in a promise chain and would like to factor it out to make maintenance easier and reduce the amount of boiler plate.

I am trying to import a function and run it as part of a connection pool with the mssql package.

const sql    = require("mssql")
const config = require("../config")
const log    = require("../util/log")

router.get('/express-route', (req, res) => {
  sql.connect(config.properties).then(pool => {
    return pool.request()
      .execute('chain')
      .then(response => { log.apiData(req, res, response) })
      .then(response => { res.send(response) }) // returns {}
      .catch(err => res.send(err))
      .finally(() => sql.close())
  })
}

...

exports.apiData = (pool, req, res, response) => {
  return pool.request()
    .input('res', sql.NVarChar(sql.MAX), res)
    .input('req', sql.NVarChar(sql.MAX), req)
    .input('response', sql.NVarChar(sql.MAX), response)
    .execute('log_data_to_sql') // nothing written to SQL
}

The following pattern works properly and I am using it as a template for this refactor.

router.get('/express-route', (req, res) => {
  sql.connect(config.properties).then(pool => {
    return pool.request()
      .execute('chain')
      .then(response => {
        return pool.request()
          .input('param', sql.NVarChar(300), response['recordsets'][0][0]['response'])
          .execute('chain2')
      })
      .then(response => {
        res.send(response['recordsets'][0][0]['response'])
      })
      .catch(err => res.send(err))
      .finally(() => sql.close())
  })
}

This is potentially different than the tagged question since it relies on a SQL connection string.

How can I chain a SQL request in a promise chain to log to SQL and then return a response to the client?