old_contents: const AWS = require('aws-sdk')
  
  // configure AWS to log to stdout
  AWS.config.update({
      logger: process.stdout
  })
  
  module.exports = function (stream, config, key) {
      const s3 = new AWS.S3({
          region: config.S3_REGION
      })
      return s3.upload({
          Key: key,
          Bucket: config.S3_BUCKET,
          Body: stream
      }).promise()
          .then((result) => {
              console.log('Uploaded to', result.Location)
              return result.Location
          })
  }
  
new_contents: const AWS = require('aws-sdk')
  
  // configure AWS to log to stdout
  AWS.config.update({
      logger: process.stdout
  })
  
  async function uploadS3(stream, config, key) {
      const s3 = new AWS.S3({
          region: config.S3_REGION
      })
      const result = await s3.upload({
          Key: key,
          Bucket: config.S3_BUCKET,
          Body: stream
      }).promise()
  
      console.log('Uploaded to', result.Location)
      return result.Location
  }
  
  module.exports = uploadS3
  
subject: use a named function for uploadS3