title: AWS Lambda: Unable to import module
body: <p>please forgive me, I am totally new at Lambda and Node.</p>
  
  <p>I am trying to replicate <a href="https://gist.github.com/bhberson/7a2847888596e67fd69b" rel="noreferrer">this</a> git to order a pizza using an AWS IoT button.</p>
  
  <p>My current code is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var pizzapi = require('dominos');
  
  var myStore = new pizzapi.Store(
      {
          ID: 'Example'
      }
  );
  
  var myAddress = new pizzapi.Address(
          {
              Street: 'Example',
              City: 'Example',
              Region: 'Example',
              PostalCode: 'Example'
          }
      );
  
  var myCustomer = new pizzapi.Customer(
      {
          firstName: 'Example',
          lastName: 'Example',
          address: myAddress,
          phone: 'Example',
          email: 'Example@gmail.com'
      }
  );
  
  var order = new pizzapi.Order(
      {
          customer: myCustomer,
          storeID: myStore.ID
      }
  );
  
  var cardNumber='Example';
  var cardInfo = new order.PaymentObject();
  cardInfo.Amount = order.Amounts.Customer;
  cardInfo.Number = cardNumber;
  cardInfo.CardType = order.validateCC(cardNumber);
  cardInfo.Expiration = 'Example';
  cardInfo.SecurityCode = 'Example';
  cardInfo.PostalCode = 'Example';
  
  order.Payments.push(cardInfo);
  
  function orderDominos(event, context) {
    var clickType = event.clickType;
    switch(clickType.toLowerCase()) {
      case "single": {
        order.addItem(
            new pizzapi.Item(
                {
                    code: 'P_14SCREEN',
                    options: {},
                    quantity: 1
                }
            )
        );
        break;
      }
      case "double": {
          order.addItem(
            new pizzapi.Item(
                {
                    code: 'P_14SCREEN',
                    options: {},
                    quantity: 1
                }
            )
        );
        break;
      }
      case "long": {
          order.addItem(
            new pizzapi.Item(
                {
                    code: 'P_14SCREEN',
                    options: {},
                    quantity: 1
                }
            )
        );
        break;
      }
    }
    order.validate(
        function(result) {
            console.log("Order is Validated");
        }
    );
    order.price(
        function(result) {
              console.log("Order is Priced");
        }
    );
    order.place(
        function(result) {
            console.log("Price is", result.result.Order.Amounts, "\nEstimated Wait Time",result.result.Order.EstimatedWaitMinutes, "minutes");
            console.log("Order placed!");
            context.succeed(event);
        }
    );
  }
  
  exports.handler = orderDominos;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The file structure is:</p>
  
  <ul>
  <li>orderDominos.js</li>
  <li>node_modules/dominos</li>
  </ul>
  
  <p>I zipped the files, uploaded to Lambda, and pointed the header to "index.handler"</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Edit: The error</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Unable to import module 'orderDominos': Error
  at Function.Module._resolveFilename (module.js:325:15)
  at Function.Module._load (module.js:276:25)
  at Module.require (module.js:353:17)
  at require (internal/module.js:12:17)
  at Object.&lt;anonymous&gt; (/var/task/node_modules/dominos/src/http-json.js:1:74)
  at Module._compile (module.js:409:26)
  at Object.Module._extensions..js (module.js:416:10)
  at Module.load (module.js:343:32)
  at Function.Module._load (module.js:300:12)
  at Module.require (module.js:353:17)</code></pre>
  </div>
  </div>
  </p>