I am working on a basic function inside of AWS Lambda, running on NodeJS. At the portion of the code I've tagged, the development environment is giving me an error saying Parsing error: Unexpected token tieDown()
If I remove the await portion the error disappears, however it is not possible to remove this because I obviously need to WAIT for that function to finish and return an object before it can begin breaking it down.
As you can see the main handler is already async, and the first await/promise portion works perfectly. So why is this failing?
const AWS = require('aws-sdk');
  const ddb = new AWS.DynamoDB.DocumentClient({region: 'us-east-1'});
  exports.handler = async (event, context) => {
    const rDom = event.referring_domain;
    const sIP = event.source_ip;
    const uA = event.user_agent;
    
    // THIS AWAIT WORKS FINE
    await checkDomain().then(data => {
     if(isEmpty(data)){
      let _response = {
        statusCode: 403,
        body: "Permission denied"
       };
       console.log("Perm denied");
      return _response;
     }else{
        // ERROR HERE!!!
        await tieDown().then(data =>{
         
        });
     };
     
     }).catch((err) => {
     console.error(err);
    });
    
  };
  
 function checkDomain(rDom){
  const params = {
   
   Key : {
     "domain" : "sample.com"
   },
   TableName: "myTable"
  };
  return ddb.get(params, function(err, data){
   if (err) console.log(err.stack);
  }).promise();
 }
 
 function isEmpty(obj) {
  for (var key in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, key)) {
      return false;
    }
  }
  return true;
}
function tieDown(sIP, uA){
 const userQuery = {
       Key : {
         "ip" : "192.168.0.1",
         "ua" : "blah"
       },
       TableName: "Table2"
      };
  return ddb.get(userQuery, function(err, data){
   if (err) console.log(err.stack);
  }).promise();
}
This is my first time every working with NodeJS/Lambda/DynamoDB so all help is appreciated, thank you!
