I was following the Alexa Trivia Skill tutorial on GitHub (https://github.com/alexa/skill-sample-nodejs-trivia) and I followed the instructions and during testing I got Remote Endpoint could not be found... so then I done further testing in AWS Lambda and I got the following Error:
{
"errorMessage": "Cannot find module './question'",
"errorType": "Error",
"stackTrace": [
"require (internal/module.js:20:19)",
"Object. (/var/task/index.js:16:19)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)"
]
}
The Link to the AWS Lambda code is : https://github.com/alexa/skill-sample-nodejs-trivia/blob/master/lambda/custom/index.js
Any Help will be Greatly Appriciated!
Thanks
Anush
Related
I am using this tutorial to link Rekognition results to a DynamoDB table.
It is giving me this error:
{
"errorMessage": "Unable to get object metadata from S3. Check object key, region and/or access permissions.",
"errorType": "InvalidS3ObjectException",
"stackTrace": [
"Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:48:27)",
"Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)",
"Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
"Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)",
"Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
"AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
"/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
"Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)",
"Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12)",
"Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:115:18)"
]
}
The code used from GitHub is this.
I made sure the region-name is the same for the lambda-bucket and the table.
I am a starter in this, so any help will be appreciated!
Thanks!
Edit:
I made some modifications and now it is giving me this:
{
"errorMessage": "Requested resource not found",
"errorType": "ResourceNotFoundException",
"stackTrace": [
"Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:48:27)",
"Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)",
"Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
"Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)",
"Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
"AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
"/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
"Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)",
"Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12)",
"Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:115:18)"
]
}
The fact that you're seeing ResourceNotFoundException suggests a couple of potential causes:
the Lambda function could not find the DynamoDB table: make sure that you modified config,js to include the name of the DynamoDB table correctly, by setting config.dynamo.tableName = '<your table>'
Rekognition could not read the image from S3: make sure that the image filename is of the form faces.jpg rather than test faces.jpg (which gets escaped to test+faces.jpg)
There are a couple of reasons why this could be happening:
1) The resource definitely does not exist. Triple-check Bucket name, DynamoDB Table name, regions, etc.
2) It's very likely that your function lacks permissions. Check the IAM Role that your Lambda function is using and attach the right policies to it. On this case, your function needs access to S3, DynamoDB and Rekognition. Make sure all of these policies are attached to the IAM role.
I'm trying to do my first skill for alexa and I'm using aws lambda for logic, my problem is that when I run the test it gives me back:
{
"errorMessage": "Cannot find module 'string-similarity'",
"errorType": "Error",
"stackTrace": [
"Function.Module._load (module.js:474:25)",
"Module.require (module.js:596:17)",
"require (internal/module.js:11:18)",
"Object.<anonymous> (/var/task/index.js:3:24)",
"Module._compile (module.js:652:30)",
"Object.Module._extensions..js (module.js:663:10)",
"Module.load (module.js:565:32)",
"tryModuleLoad (module.js:505:12)",
"Function.Module._load (module.js:497:3)"
]
}
I need string-similarity to compare two strings but I do not understand how to install it in lambda.
this is my package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"alexa",
"skill"
],
"author": "",
"license": "",
"dependencies": {
"ask-sdk": "^2.0.0",
"string-similarity": "^1.2.0",
"i18next": "^10.6.0",
"i18next-sprintf-postprocessor": "^0.2.2"
}
}
and so I call the package in the index.js
'use strict';
const Alexa = require('ask-sdk');
var stringSimilarity = require('string-similarity');
...
how can i solve this error
thanks for your help and sorry for my english but I'm not a native speaker.
You are getting this error because you are using 'string-similarity' but you have not installed it in your project that is why it is giving you "errorMessage": "Cannot find module 'string-similarity'".
You can not add Node Modules directly in Lambda function. If you need to use external modules/libraries you need to have your project in local machine so you can npm install the required modules an then upload the .ZIP file of your project in lambda function see details HERE.
Alternatively you can use ASK CLI to write your code some editor of your choice and deploy the lambda function with a simple command.
I'm getting this error when I upload and test my AWS Lambda function.
{
"errorMessage": "Cannot find module 'ical'",
"errorType": "Error",
"stackTrace": [
"Function.Module._load (module.js:417:25)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)",
"Object.<anonymous> (/var/task/index.js:2:14)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)"
]
}
Can you please help me to solve this error.
Please Make sure node_moduels directory is readable
chmod -R +r node_modules
On creation of a lambda function for a Decision Tree, the execution of the Test Event generates an error.
{
"errorMessage": "Cannot find module '/var/task/index'",
"errorType": "Error",
"stackTrace": [
"Function.Module._load (module.js:417:25)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)"
]
}
Could someone point me in the right direction?
Links: https://developer.amazon.com/blogs/post/TxHGKH09BL2VA1/New-Alexa-Skills-Kit-Template-Step-by-Step-Guide-to-Build-a-Decision-Tree-Skill
https://github.com/tartanguru/alexa-assistant/issues/8
I am trying to do a simple require of my own lib in AWS Lambda, but it can't find it. What am I missing?
var a = require('./lib/a');
exports.handler = function(event, context, callback) {
callback(null, 'Testing');
}
Yeah, this works when testing it locally, but not when zipped and deployed. I am zipping just the file, not the directory and removing the require makes it work.
{
"errorMessage": "Cannot find module './lib/a'",
"errorType": "Error",
"stackTrace": [
"Function.Module._load (module.js:417:25)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)",
"Object.<anonymous> (/var/task/index.js:1:77)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)"
]
}
Directory structure:
index.js
lib/a.js
I am zipping just the file
Try to download your package from the AWS Lambda console. You'll receive a zip file and try to extract that on your local machine. Can you see the lib folder with a.js inside it?
Chances are, the zip file that you uploaded probably missed the lib directory.