title: Read from Secrets Manager in AWS Lambda function
body: <p>I am trying to use the Node.js sample code that AWS Secrets Manager provides to read a secret value, and am putting this code inside a Lambda function.  However, I can't seem to get into the function that handles the response from getting the secret value.</p>
  
  <p>The Lambda role has AdministratorAccess permissions to rule out it being a permissions issue.</p>
  
  <p>Lambda Code:</p>
  
  <pre><code>exports.handler = async (event) =&gt; {
  
  // Load the AWS SDK
  var AWS = require('aws-sdk'),
      region = "us-east-1",
      secretName = "/my-secrets/level1/level2",
      secret,
      decodedBinarySecret;
  
  var client = new AWS.SecretsManager({
      region: region
  });
  
  console.log('above')
  
  client.getSecretValue({SecretId: secretName}, function(err, data) {
  
      console.log('in')
  
      if (err) {
         throw err;
      }
      else {
          if ('SecretString' in data) {
              secret = data.SecretString;
          } else {
              let buff = new Buffer(data.SecretBinary, 'base64');
              decodedBinarySecret = buff.toString('ascii');
          }
      }
  
      console.log(secret)
  });
  
  console.log('below')
  </code></pre>
  
  <p>};</p>
  
  <p>OUTPUT</p>
  
  <pre><code>2020-03-05T18:51:54.547Z    a3101875-a1f4-4b6f-ac62-3c2f93f5941f    INFO    above
  2020-03-05T18:51:54.947Z    a3101875-a1f4-4b6f-ac62-3c2f93f5941f    INFO    below
  </code></pre>
  
  <p>Because the secret exists, I would expect to see "in" and the secret lines in the output...what is preventing it from getting inside that function?</p>