zip files and the lambda console

Discussion in 'Amazon Echo Development' started by iWombat, Jun 25, 2015.

  1. iWombat

    iWombat New Member

    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male
    I have gotten several examples to work in the lambda console, but I am confused about how to place my code in a zip file for upload using the console.

    When I take the code in Function window and cut and paste it to a file:
    ./Cooters-App/CootersLambda.js

    I have tried zipping this up in multiple ways, first the file only:

    unzip -lv CootersLambda.zip
    Archive: CootersLambda.zip
    Length Method Size Ratio Date Time CRC-32 Name
    -------- ------ ------- ----- ---- ---- ------ ----
    7817 Defl:N 2099 73% 06-24-15 18:14 fa4d0a1d CootersLambda.js
    -------- ------- --- -------
    7817 2099 73% 1 file

    and then the directory with file:

    unzip -lv CootersLambda.zip
    Archive: CootersLambda.zip
    Length Method Size Ratio Date Time CRC-32 Name
    -------- ------ ------- ----- ---- ---- ------ ----
    0 Stored 0 0% 06-24-15 18:17 00000000 Cooters-App/
    7817 Defl:N 2099 73% 06-24-15 18:14 fa4d0a1d Cooters-App/CootersLambda.js

    In both cases when I upload the zip to the console it give me this error:

    {
    "errorMessage": "Cannot find module 'index'",
    "errorType": "Error",
    "stackTrace": [
    "Function.Module._resolveFilename (module.js:338:15)",
    "Function.Module._load (module.js:280:25)",
    "Module.require (module.js:364:17)",
    "require (module.js:380:17)"
    ]
    }

    Can someone tell me if I need to include more in the zip file than the contents
    of the Function Code window? Or perhaps, I am still zipping the files wrong?
     
  2. iWombat

    iWombat New Member

    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male
    ok, I guess in the console under "Handler" you need to change the value "index.handler" to "<function_name>.handler" where <function_name> is the name you uploaded it to the console with. Examples are a little unclear.
     

Share This Page