question

Sammy Zimmermanns avatar image
Sammy Zimmermanns asked

After Update to ASK-CLI V2 Skill isn't working

Hi guys, I accidentally upgraded my ASK CLI V1 to ASK CLI V2 yesterday. I then changed the directory structure of my skill as described in the instructions: https://developer.amazon.com/de-DE/docs/alexa/smapi/ask-cli-v1-to-v2-migration-guide.html


I could also update the skill. But now I get this error when I call up the skill:

{    "errorType": "Runtime.ImportModuleError",    "errorMessage": "Error: Cannot find module './dispatcher/error/mapper/GenericErrorMapper'\nRequire stack:\n- /var/task/node_modules/ask-sdk-runtime/dist/index.js\n- /var/task/node_modules/ask-sdk-core/dist/attributes/AttributesManagerFactory.js\n- /var/task/node_modules/ask-sdk-core/dist/index.js\n- /var/task/node_modules/ask-sdk/dist/skill/factory/StandardSkillFactory.js\n- /var/task/node_modules/ask-sdk/dist/index.js\n- /var/task/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",    "stack": [        "Runtime.ImportModuleError: Error: Cannot find module './dispatcher/error/mapper/GenericErrorMapper'",        "Require stack:",        "- /var/task/node_modules/ask-sdk-runtime/dist/index.js",        "- /var/task/node_modules/ask-sdk-core/dist/attributes/AttributesManagerFactory.js",        "- /var/task/node_modules/ask-sdk-core/dist/index.js",        "- /var/task/node_modules/ask-sdk/dist/skill/factory/StandardSkillFactory.js",        "- /var/task/node_modules/ask-sdk/dist/index.js",        "- /var/task/index.js",        "- /var/runtime/UserFunction.js",        "- /var/runtime/index.js",        "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",        "    at Object.<anonymous> (/var/runtime/index.js:43:30)",        "    at Module._compile (internal/modules/cjs/loader.js:1133:30)",        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)",        "    at Module.load (internal/modules/cjs/loader.js:977:32)",        "    at Function.Module._load (internal/modules/cjs/loader.js:877:14)",        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)",        "    at internal/main/run_main_module.js:18:47"    ] }

Why does this error occur and how can I fix it?

ask cli
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sammy Zimmermanns avatar image
Sammy Zimmermanns answered

Wow, i found the solution here: https://github.com/alexa/ask-cli/issues/59

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sammy Zimmermanns avatar image
Sammy Zimmermanns answered

Install as admin in Windows Powershell

Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force

After fixing Powershell, please re-run the ask deploy again to let CLI re-build your code, which will compress your code correctly this time, and finally upload it to Lambda. Lambda should work now.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Robert G Schaffrath avatar image
Robert G Schaffrath answered

I had upgraded to V2 a while back and also had to search out the patch in order to get PowerShell working properly. In the end, I found I just did not like ask-cli V2 at all so I downgraded back to the earlier version with "npm i ask-cli@1.7.23". Besides the slower archiving, I also miss the "-t" argument to "deploy" that allowed me to deploy only specific parts of a skill such as "lambda", "model" and "skill".

I am all for upgrading to newer software that adds and improves features but I hate "upgrades" that remove features and provide me what I consider to be a poorer experience. Thankfully, ask-cli 1.7.23 still works and I will stick with it as long as possible.

2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ron Wang avatar image Ron Wang commented ·

Hi @Aardvark v2 ask-cli tries to incorporate the target option by a smarter service level package digesting. You don't need to use target and service deploy the only changed part. Is this the biggest reason that you are sticking to v1 cli?

0 Likes 0 ·
Robert G Schaffrath avatar image Robert G Schaffrath Ron Wang commented ·

I had not seen this response and it has almost been a year. Sorry.


I still use ask-cli 1.7.23. As I noted, I like to be able to specifically choose what I want to deploy. For example, due to the recent deprecation of Display Templates in favor of APL, I found myself making changes to just my Lambda code. No reason to deploy the models and skill configuration when all I wanted was Lambda. Plus, I miss the --force argument that I would need occasionally with Lambda. Sometimes I would change the Node.js runtime version or some other operational parameter of the Lambda function through the console which then causes a deployment to fail on eTag mismatch without --force. In the brief time I played with ask-cli V2, I could not figure out how to get around the Lambda error regarding eTag changes to the function. With V1 I would simply --force. With V2, I have no idea.

0 Likes 0 ·