title: AWS Lambda Error: "Cannot find module '/var/task/index'"
body: <p><strong>Node.js Alexa Task Issue</strong></p>
  <p>I'm currently coding a Node.js Alexa Task via AWS Lambda, and I have been trying to code a function that receives information from the OpenWeather API and parses it into a variable called <code>weather</code>. The relevant code is as follows:</p>
  <pre><code>var request = require('request');
  var weather = &quot;&quot;;
  function isBadWeather(location) {
        var endpoint = &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot; + location + &quot;&amp;APPID=205283d9c9211b776d3580d5de5d6338&quot;;
        var body = &quot;&quot;;
        request(endpoint, function (error, response, body) {
              if (!error &amp;&amp; response.statusCode == 200) {
                    body = JSON.parse(body);
                    weather = body.weather[0].id;
              }
        });
  }
  
  function testWeather()
  {
        setTimeout(function() {
        if (weather &gt;= 200 &amp;&amp; weather &lt; 800)
              weather = true;
        else
              weather = false;
        console.log(weather);
        generateResponse(buildSpeechletResponse(weather, true), {});
        }, 500);
  }
  </code></pre>
  <p>I ran this snippet countless times in Cloud9 and other IDEs, and it seems to be working flawlessly. However, when I zip it into a package and upload it to AWS Lambda, I get the following error:</p>
  <pre><code>{
      &quot;errorMessage&quot;: &quot;Cannot find module '/var/task/index'&quot;,
      &quot;errorType&quot;: &quot;Error&quot;,
      &quot;stackTrace&quot;: [
          &quot;Function.Module._load (module.js:276:25)&quot;,
          &quot;Module.require (module.js:353:17)&quot;,
          &quot;require (internal/module.js:12:17)&quot;
      ]
  }
  </code></pre>
  <p>I installed module-js, request, and many other Node modules that should make this code run, but nothing seems to fix this issue. Here is my directory, just in case:</p>
  <pre><code>- planyr.zip
     - index.js
     - node_modules
     - package.json
  </code></pre>
  <p>Does anyone know what the issue could be?</p>