Search code examples
amazon-web-servicesaws-lambdaalexa-skills-kit

Problems uploading lambda function code on Amazon Web Services console


I'm trying to build an Alexa prototype for a client using this tutorial : https://developer.amazon.com/public/community/post/Tx3DVGG0K0TPUGQ/New-Alexa-Skills-Kit-Template:-Step-by-Step-Guide-to-Build-a-Fact-Skill

I am getting errors when I upload the zip file with the Alexskill.js and index.js files in it. I believe these are in the system itself and nothing to do with my code. Here is a screen grab of my browser console:

https://developer.amazon.com/public/community/post/Tx3DVGG0K0TPUGQ/New-Alexa-Skills-Kit-Template:-Step-by-Step-Guide-to-Build-a-Fact-Skill

There's no way to see if the zip file you upload has been successful (frustrating) - but this looks bad right?

Obviously, when I try and test the lambda function I get this error:

{
  "errorMessage": "Cannot find module 'index'",
  "errorType": "Error",
  "stackTrace": [
    "Function.Module._load (module.js:276:25)",
    "Module.require (module.js:353:17)",
    "require (internal/module.js:12:17)"
  ]
}

I desperately need to get this working. Has anyone got the code in one file that I can use to do this using the inline code editor? I am using the FactSkill demo which is very basic.


Solution

  • This is one of those 'I want to kick myself around the room' moments. In this article it tells you to download the ZIP archive from GIT and then upload it to the lambda control panel. When you do that on a mac it unzips it into a folder for you. I then zipped that folder back up and uploaded it. That was my problem ...

    You need to zip the two files inside the folder and not the folder itself!

    Then it can see the module from the archive.

    DOH!!!

    But, still ... Amazon, wtf is going on with all those errors?