ask-sdk-local-debug 1.1.0

Creator: railscoder56

Last updated:

Add to Cart

Description:

asksdklocaldebug 1.1.0

ASK SDK Local debug - Debugger for Python ASK SDK
ASK SDK Local Debug (ask-sdk-local-debug) is a package which enables you to test your skill code locally against your skill invocations
by routing requests to your developer machine. This enables you to verify changes quickly to skill code as you
can test without needing to deploy skill code to Lambda.

Note
This feature is currently only available to customers in the NA region.


Quick Start
Installation
Assuming that you have Python and virtualenv installed, you can
install the package from PyPi as follows:
$ virtualenv venv
$ . venv/bin/activate
$ pip install ask-sdk-local-debug
You can also install the package locally by following these steps:
$ git clone https://github.com/alexa/alexa-skills-kit-sdk-for-python.git
$ cd alexa-skills-kit-sdk-for-python/ask-sdk-local-debug
$ virtualenv venv
...
$ . venv/bin/activate
$ python setup.py install


Usage and Getting Started

Using Alexa SKills toolkit for VSCode
The Alexa Skills Toolkit for Visual Studio
offer integrated support for local debugging. To get started, please review our technical documentation on
how to Test your local Alexa skill using VSCode.

Note
If you have existing an ASK CLI profile, you will need to sign in again using the latest version of ASK CLI (>=2.13).
Once installed, simply re-run ask configure to re-authorize your profile for local debugging.



Using with other IDEs and Debuggers


To instantiate a connection to the local debugging service, retrieve the following details for your skill :


ACCESS_TOKEN :

Install ASK CLI v2.

npm install ask-cli@2 -g

Generate the accessToken using ASK CLI

ask util generate-lwa-tokens --scopes alexa::ask:skills:debug

You will be directed to a Login with Amazon page. Sign in and retrieve your ACCESS_TOKEN from the terminal.




SKILL_ID : The ID of the skill you are trying to debug. Ensure that the developer account you used to login to obtain the access token has access to this skill.
HANDLER_NAME : The exported handler method (typically lambda_handler or handler). For example, please see the Hello world example.
FILE_NAME : The path to your skill code’s main file (typically lambda_function.py). This file or module contains the skill’s handler function.
REGION : The region of the developer account. The accepted values are NA(North America), FE(Far East), EU(Europe). Defaults to NA. Instructions on finding out your region can be found here.




Create a local_debug.py file in your skill’s lambda directory and add the following code :

from ask_sdk_local_debug.local_debugger_invoker import LocalDebuggerInvoker

if __name__ == "__main__":
LocalDebuggerInvoker([
'--accessToken', '<ACCESS_TOKEN>',
'--skillId', '<SKILL_ID>',
'--skillHandler', '<HANDLER_NAME>',
'--skillFilePath', '<FILE_NAME>'
"--region", "<REGION>" # Optional argument. Region defaults to NA.]
).invoke()


Configure your preferred IDE or other debugging tool to attach to the above process or execute directly from your preferred IDE. For example, in VS Code, this would be included in the launch.json:

{
"type": "python",
"request": "launch",
"name": "Skill Debug",
"program": "<Absolute file path to local_debug.py>",
"args": [
"--accessToken", "<ACCESS_TOKEN>",
"--skillId", "<SKILL_ID>",
"--skillHandler", "<HANDLER_NAME>",
"--skillFilePath", "<FILE_NAME>",
"--region", "<REGION>" # Optional argument. Region defaults to NA.
]
}






Things to note

Local debugging is only available for a skill’s development stage.
A connection remains active for 1 hour. You will need to reinstantiate the connection after 1 hour.
All Alexa requests for the skill will be routed to your development machine while the connection is active.
Only one connection session may be active for a given Skill ID and developer account.



Got Feedback?

We would like to hear about your bugs, feature requests, questions or quick feedback.
Please search for the existing issues before opening a new one. It would also be helpful
if you follow the templates for issue and pull request creation. Please follow the contributing guidelines!
Request and vote for Alexa features!




CHANGELOG
1.0.0

Initial release of ask sdk local debugger package.


1.1.0
This release contains the following changes :

region support in local debug invoker.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.