title: Import Module error when deploying compiled typescript to lambda
body: <p>I'm converting some of my JS code to typescript and when deploying using serverless framework to a lambda on AWS and running it i'm getting the below error. At first I thought one of my imports was bad but it looks like everything is as expected. </p>
  
  <blockquote>
    <p>{
     "errorType": "Runtime.ImportModuleError",
     "errorMessage": "Error: Cannot find module 'tslib'\nRequire stack:\n- /var/task/handlers/Create.js\n- >/var/runtime/UserFunction.js\n- /var/runtime/index.js",
     "trace": [
       "Runtime.ImportModuleError: Error: Cannot find module 'tslib'",
       "Require stack:",
       "- /var/task/handlers/Create.js",
       "- /var/runtime/UserFunction.js",
       "- /var/runtime/index.js",
       "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
       "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
       "    at Object. (/var/runtime/index.js:43:30)",
       "    at Module._compile (internal/modules/cjs/loader.js:956:30)",
       "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)",
       "    at Module.load (internal/modules/cjs/loader.js:812:32)",
       "    at Function.Module._load (internal/modules/cjs/loader.js:724:14)",
       "    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)",
       "    at internal/main/run_main_module.js:17:11"
     ]
    }</p>
  </blockquote>
  
  <p>Serverless: </p>
  
  <pre><code>functions:
    createFamily:
      name: ${self:custom.createFamilyName}
      handler: handlers/Create.createFamily
      description: Lambda for Creating a family in the family service
      timeout: 30
      events:
        - http:
            path: /family
            method: post
            private: true
  </code></pre>
  
  <p>Handler:</p>
  
  <pre><code>import { APIGatewayEvent, Context, ProxyResult } from 'aws-lambda';
  import { utilities } from '../handlers/utilities';
  import { familyService } from '../services/FamilyService';
  import { IFamily } from '../interfaces/IFamily';
  
  let familyData: IFamily;
  let serverReturn: IFamily;
  
  export const createFamily = async (
      event: APIGatewayEvent,
      context: Context
  ): Promise&lt;ProxyResult&gt; =&gt; {
      try {
          if (!event.body) {
              return utilities.BuildResponse(400, JSON.stringify('Object to create was not provided'));
          }
          familyData = JSON.parse(event.body);
          serverReturn = await familyService.createFamily(familyData);
  
          if (!serverReturn) {
              return utilities.BuildResponse(404, JSON.stringify('Failed to create Family'));
          }
  
          return utilities.BuildResponse(201, JSON.stringify(serverReturn));
      } catch(err) {
          console.error('Family Service Create a family error: ', err);
          return utilities.BuildResponse(500, JSON.stringify('Family Service internal server error'));
      }
  }
  </code></pre>