title: tesseract-ocr works on EC2, not lambda
body: <p>My goal is to run tesseract-ocr in AWS Lambda.</p>
  
  <p>I've built an EC2 instance that attempts to mirror the Lambda environment. Executing tesseract without parameters succeeds in both environments. However, any attempt at substantive image processing, e.g. this code:</p>
  
  <pre><code>tess = child_process.exec('tesseract input.tif output -l eng -psm 1 hocr', function(error, stdout, stderr) {
  ...
  </code></pre>
  
  <p>runs successfully on my EC2 box, but fails in Lambda with this error:</p>
  
  <pre><code>Error: Command failed: Tesseract Open Source OCR Engine v3.04.00 with Leptonica
  Error during processing.
  
   at ChildProcess.exithandler (child_process.js:648:15)
   at ChildProcess.emit (events.js:98:17)
   at maybeClose (child_process.js:756:16)
   at Process.ChildProcess._handle.onexit (child_process.js:823:5)
  Error code: 1
  Signal received: null
  </code></pre>
  
  <p>Lambda is assuming an IAM role with administrative privileges ({ "Effect": "Allow", "Action": "<em>", "Resource": "</em>" })</p>
  
  <p>The "Error during processing" error is emitted by tesseract as a top level catch-all. I'm going to instrument tesseract and try to narrow the problem further.</p>
  
  <p>How I got here:</p>
  
  <ul>
  <li>My EC2 machine is a t2.micro running Amazon Linux in us-east-1 (amzn-ami-hvm-2014.09.2.x86_64-ebs (ami-146e2a7c)).</li>
  <li>I installed node 0.10.33 and aws-sdk@2.0.23, which match the Lambda versions.</li>
  <li>I compiled tesseract and leptonica from source. Added an rpath and have run ldd to confirm that all dependencies are found</li>
  <li>tesseract binaries and liblept.so are all in my root directory (/var/task)</li>
  </ul>
  
  <p>I'd like to know what's going wrong - or how to diagnose it.</p>
  
  <p>Thank you,
  Dave</p>