Executing Alexa Tutorial Code ALWAYS Fails - Beginner

时间:2017-08-30 20:36:58

标签: amazon-web-services alexa alexa-skills-kit alexa-skill

I'm new to Alexa Skill development and I'm sure this issue is process/environmental due to lack of experience.

Whenever I try to use a sample from an offical Alexa tutorial, I can never get the skill to pass the first TEST - always getting an error :(

In this case I am trying to run and fiddle with this tutorial: https://developer.amazon.com/blogs/post/TxHGKH09BL2VA1/New-Alexa-Skills-Kit-Template-Step-by-Step-Guide-to-Build-a-Decision-Tree-Skill

What is happening / What I've done:

  • I download the Node SDK from the Git link, I also download the sample from the Git link. I then create a new ZIP that contains the sample code with the Node SDK included in the path /src/alexa-sdk/

  • I go to AWS and create a new function, not using a blueprint. I 'author from scratch' and create a function with the Skills Kit as a trigger. I name the function and use Node 6.10 runtime.

  • I upload my ZIP file and leave all boxes default, for Role I choose Custom Role then pick Basic Execution from the Role screen.

  • I leave the rest blank, go to NEXT and CREATE.

The function is created okay, but I do see this error 'This function contains external libraries. Uploading a new file will override these libraries.'

Here's the problem - this is the point of failure on all tutorials I've tried so far. I go to Configure Test Event, I choose ALEXA START SESSION as the template and click Save And Test...

EXECUTION RESULT FAILED:

parse

Here's something from associated error logs, unsure if it's useful:

DateTimeFormatter f = DateTimeFormatter.ofPattern( "MMuu" ) ;
try {
    YearMonth ym = YearMonth.parse( "1803" , f ) ;
} catch ( DateTimeParseException e ) {
    … handle error.
}

I have noticed two things that I suspect may be an issue:

1) When I go to the CODE tab for this function, I see this message:

2017-07

2) When I look at the code that's inserted into the test when I choose ALEXA SESSION START, I see many instances of 'unique value here':

{
  "errorMessage": "Cannot find module '/var/task/index'",
  "errorType": "Error",
  "stackTrace": [
    "require (internal/module.js:20:19)"
  ]
}

Although, there is no mention of this in the tutorial link I am referencing.

I'm really downhearted about it now as this is like the 3rd tutorial code I've tried to configure. Can anybody with experience follow the steps I've taken and point me in the right direction.

Thank you SO MUCH in advance if so.

EDIT: Absolute Clarification on how I am creating the ZIP file I'm using Windows 10 and Chrome to download the files from GitHub.

  • I download the skill-sample-nodejs-decision-tree-master ZIP file from GitHub,
  • I do not know how to use NPM so I do this simply via downloading to desktop.
  • I then download the alexa-skills-kit-sdk-for-nodejs-master.ZIP file to desktop.
  • I unzip the contents of decision-tree-master into a folder on the desktop also called alexa-skills-kit-sdk-for-nodejs-master.
  • Within this folder, I navigate to /src/ and create a new folder called 'node_modules' within /src/.
  • Within /src/node_modules/ I now create another new folder called 'alexa-sdk'.
  • I unzip the contents of alexa-skills-kit-sdk-for-nodejs-master.zip into /src/node_modules/alexa-sdk/.

I have tried two approaches from here - both fail:

1) I ZIP only the contents of /src/ (not including the /src/ folder itself) and upload to Amazon.

2) I ZIP the entire 'decision-tree-master' folder and upload to Amazon.

I must be missing something, as I said this is just one of many Alexa tutorials I've tried to get working and this always happens :( So disheartened now.

1 个答案:

答案 0 :(得分:0)

这是我在许多帖子中看到的常见问题。大多数情况下,这是解压缩文件的方式。您不必压缩文件夹,而是必须选择所有文件并将其压缩如下,

enter image description here