-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to import module 'index': Error #6
Comments
I'm also seeing the following error in my terminal: Error(s) found in the deploy setting for the following in-skill product(s): Missing file: [ID] undefined [FILE] isps/entitlement/Entitlement_Template.json And I have updated the release date to be a future date. |
Normally Lambda is looking for a file in the root of the deployment package that matches the handler name. In this case, index.js. This file will export a handler function, which is invoked when Alexa passes the request to the Lambda function. In order for this to work, assuming all of the files were properly cloned, there should be an index.js file in the lambda/custom folder in your project (the project root is where the skill.json file is located, and is where you should be running the Check that the index.js file is present in the lambda/custom folder (and has the code found in the repo). If it is, retry the As for the second issue, that looks to be solved here: #7. |
The picture you posted looks correct. (I'm using lambda/custom as shorthand to indicate there's a custom folder in the lambda folder.) The clone should result in the same as the You indicated that the If you are comfortable with what the ask-cli does, you don't have to manually modify the files as described in the first section of the instructions. You can clone the repo and skip to the second section. |
Thanks for your response! After searching some forums, what ended up getting rid of the module index error was changing the permissions on the files and then zipping the contents of the custom folder, and uploading that directly to my lambda console. Unfortunately, when I test the skill, I see the following: Any ideas? |
It looks like there isn't a call being made to the lambda function (the error is happening before that), is that correct? If so, I'm not sure what to suggest other than disabling and re-enabling the skill for testing. I have not seen this error before. |
Fixed! Thank you!! |
@annasxu how did you fix it? I'm getting the same error after changing my lambda from node 4 to node 8, I just changed the runtime and I am getting that error. |
In my case I was getting this because I tried to require something that wasn't in node_modules. |
select all your files (index.js, node_modules, package.json) then add to the archive, what we are doing here is we are zipping the entire folder that's why AWSlambda is not able to read the index.js file. try it and let me know. |
@next-nurialopez are you having a problem with this sample, or are you just generally trying to upgrade your lambda function from node 4 to node 8? If the latter, the Alexa Forums would be a better place to ask that question. That said, as the others have suggested, check your requires statements and confirm that the modules you are requiring are available. If you had a working function using Node 4, and all you changed was the runtime, then I would expect it to still work. Try looking at your stack trace and see if you can identify the specific line with the problem and that should provide a clue as to how to proceed. If you're not sure how to read your stack trace, you could post it here and we might be able to help. |
Hi, I followed the instructions exactly, but I'm getting the following error in the cloud log. What does it mean and how can I correct it?
Unable to import module 'index': Error
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/var/task/index.js:6:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
The text was updated successfully, but these errors were encountered: