AWS Lambda: failed execution with no errors
<p>I've written a Python script (<code>upload.py</code>) that is working independently of AWS Lambda. It uploads data as POST to an API. It has the following method to handle a Lambda execution:</p>

<pre><code>def handler(event, context):
    print("Hello!")
    start()
</code></pre>

<p>When I call <code>start()</code> on my local machine, the script runs successfully. </p>

<p>When I upload the code to Lambda and run a test or initiate a trigger, nothing happens. The following is printed out:</p>

<pre><code>START RequestId: 6abc0995-865c-11e6-b015-57198f9121b5 Version: $LATEST
END RequestId: 6abc0995-865c-11e6-b015-57198f9121b5
REPORT RequestId: 6abc0995-865c-11e6-b015-57198f9121b5  Duration: 2056.85 ms    Billed Duration: 2100 ms
</code></pre>

<p>However, when I introduce an error to the code (for example adding a string and integer), the error is printed out.</p>

<p>Everything in settings is correctly defined (e.g. upload.handler) and no VPC is assigned to eliminate network issues. The execution role has Administrator privileges to eliminate that as a possibility as well.</p>

<p>So it turns out that the "sys" library isn't permitted in a Lambda, which makes sense in hindsight. To deal with potential encoding issues I had the following code:</p>

<pre><code>import sys
reload(sys)
sys.setdefaultencoding('utf-8')
</code></pre>

<p>As suggested in another Stack Overflow thread. This apparently was blocking execution. Removal allowed the script to execute properly. </p>

python amazon-web-services aws-lambda amazon-lambda