title: Custom resource not running properly on deployment
body: <p>For over two days, I've been trying to deploy a CloudFormation stack using serverless framework. The thing is, as part of the stack, I have an RDS cluster as well as a custom resource which relies on a Lambda function (written in Python) for <em>initializing</em> some database tables.</p>
  
  <p>The details of this custom resource in the serverless.yml file are the following:</p>
  
  <pre><code>rdsMigration:
    Type: Custom::DatabaseMigration
    DependsOn: rdsCluster
    Properties:
      ServiceToken: !GetAtt MigrateDatabaseLambdaFunction.Arn
      Version: 1.0
  </code></pre>
  
  <p>When deploying using <code>sls deploy</code>, the cluster and the lambda functions are created correctly, but the process is stuck on creating the <code>rdsMigration</code> resource. </p>
  
  <p>In the Lambda code, I've been careful to generate the response in all possible scenarios, including exceptions. However, that does not seem to be the problem.</p>
  
  <p>Apparently, the function is not being invoked... kind of, because even the charts look weird:</p>
  
  <p><a href="https://i.stack.imgur.com/rQAHM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rQAHM.png" alt="Monitoring of the Lambda function"></a></p>
  
  <p>You can see how there are no invocations, but there is a red dot in "Error count and success rate" about 5:15 PM, which is the time at which the resource creation started. Also, there are no green dots, and you can see the warning down in the legend, which claims that "One or more data-points have been dropped due to non-numeric values (NaN, -Infinite, +Infinite)". How is this possible? I assume it is no standard behavior, since other Lambda functions (which must be called using an API Gateway endpoint) do not show this strange chart.</p>
  
  <p>Also, there are no log streams in CloudWatch. It is completely empty, as if the function was never invoked (which seems the case, except for the strange "red dot" at the moment of resource creation).</p>
  
  <p>Finally, if I run a test case using the "AWS CloudFormation Create Request" template, the function runs properly, it creates the initial tables I expected for the DB (not always, but that is a different matter) and returns the response.</p>
  
  <p>Do you have any idea of what is going on here? The worst about this is that I need to wait two hours between tests, since the CFN stack gets stuck during the creation and destruction steps until the timeout occurs.</p>
  
  <p>Thanks!</p>