title: Different Behavior Deploying AWS Lambda Standalone vs within an Application Stack
body: <p>Hi everybody and thanks for taking time to look at my issue/question.</p>
  <p>I am getting different results when deploying my AWS Lambda stand-alone versus within an Application Stack.</p>
  <p>I'm trying to connect to AWS Elasticache Redis from within my Lambda. I have .Net Core 3.1 Lambdas (using StackExchange.Redis) which can connect.  But I also need to be able to connect from my Node.js Lambdas.</p>
  <p>For the Node.js Lambdas, I'm using &quot;node-redis&quot; and &quot;async-redis&quot;.  I have two Lambdas which are essentially identical except that one is deployed in an Application Stack and the other is deployed as a stand-alone Lambda.  Both Lambdas reference the same Lambda Layer (i.e. same &quot;node_modules&quot;), have the same VPC settings, the same Execution Role, and essentially the same code.  So they've pushed it up to another group.</p>
  <p>The stand-alone Lambda connects to Redis without issue. The Application Stack Lambda does not and exits processing before completing but without raising any error.</p>
  <p>At first I thought I might just need to configure my Application Stack but I cannot find any information indicating we even can configure Application Stacks.  So I'm at a loss.</p>
  <p>The stand-alone Lambda:</p>
  <pre><code> exports.handler = async (event) =&gt; {
          const asyncRedis = require(&quot;async-redis&quot;);
          const redisOptions = 
          {
              host: &quot;XXXXXXXXX.XXXXX.XXXX.use2.cache.amazonaws.com&quot;,
              port: 6379
          }
      
          console.log('A');
          const client = asyncRedis.createClient(redisOptions);
          console.log(client);
      
          console.log('B');
          const value = await client.get(&quot;Key&quot;);
      
          console.log('C');
          console.log(value);
      
          console.log('D');
          console.log(client);
      };
  </code></pre>
  <p>The output of this function is essentially:</p>
  <pre><code>A
  {RedisClient} --&gt; the &quot;client&quot; object --&gt; Shows connected = false
  B
  C
  { Correct Data From Redis }
  D
  {RedisClient} --&gt; the &quot;client&quot; object --&gt; Shows connected = true
  </code></pre>
  <p>The Application Stack Lambda:</p>
  <pre><code>async function testRedis2(event, context) {
      console.log('In TestRedis2');
      const asyncRedis = require(&quot;async-redis&quot;);
      const redisOptions = 
      {
          host: &quot;XXXXXXXXX.XXXXX.XXXX.use2.cache.amazonaws.com&quot;,
          port: 6379
      }
          console.log('A');
          const client = asyncRedis.createClient(redisOptions);
          console.log(client);
      
          console.log('B');
          var value = await client.get(&quot;Key&quot;);
  
          console.log('C');
          console.log(value);
          
          console.log('D');
          console.log(client);
      }
  
  module.exports = {
      testRedis2
  };
  </code></pre>
  <p>The output of this function is essentially:</p>
  <pre><code>In TestRedis2
  A
  {RedisClient} --&gt; the &quot;client&quot; object --&gt; Shows connected = false
  B
  </code></pre>
  <p>I don't understand why these don't perform identically.  And I don't get why I don't see further entries in the output.</p>
  <p>Has anyone else experienced issues connecting to VPC resources from within an Application Stack?</p>
  <p>Thanks</p>