The middleware function does include the `next` callback so only resolve
the Promise when it's called. If it's never called, the middleware stack
completion will stall
function withCallbackHandler(ctx, connectMiddleware, next) {
  return new Promise((resolve, reject) => {
    connectMiddleware(ctx.req, ctx.res, err => {
      if (err) reject(err)
      else resolve(next())
    })
  })
}