Package: ask-sdk-local-debug
ASK SDK Local debug - Debugger for Python ASK SDKASK 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.NoteThis feature is currently only available to customers in theNA region.Quick StartInstallationAssuming that you have Python andvirtualenvinstalled, you can
install the package from PyPi as follows:$virtualenvvenv$.venv/bin/activate$pipinstallask-sdk-local-debugYou can also install the package locally by following these steps:$gitclonehttps://github.com/alexa/alexa-skills-kit-sdk-for-python.git$cdalexa-skills-kit-sdk-for-python/ask-sdk-local-debug$virtualenvvenv...$.venv/bin/activate$pythonsetup.pyinstallUsage and Getting StartedUsing Alexa SKills toolkit for VSCodeTheAlexa Skills Toolkit for Visual Studiooffer integrated support for local debugging. To get started, please review our technical documentation on
how toTest your local Alexa skillusing VSCode.NoteIf you have existing anASK CLIprofile, you will need to sign in again using the latest version of ASK CLI (>=2.13).
Once installed, simply re-runask configureto re-authorize your profile for local debugging.Using with other IDEs and DebuggersTo instantiate a connection to the local debugging service, retrieve the following details for your skill :ACCESS_TOKEN:InstallASK CLI v2.npminstallask-cli@2-gGenerate the accessToken using ASK CLIaskutilgenerate-lwa-tokens--scopesalexa::ask:skills:debugYou 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 (typicallylambda_handlerorhandler). For example, please see theHello world example.FILE_NAME: The path to your skill code’s main file (typicallylambda_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 foundhere.Create alocal_debug.pyfile in your skill’s lambda directory and add the following code :fromask_sdk_local_debug.local_debugger_invokerimportLocalDebuggerInvokerif__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>"#Optionalargument.RegiondefaultstoNA.]}Things to noteLocal debugging is only available for a skill’sdevelopmentstage.A connection remains active for1 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 theexisting issuesbefore opening a new one. It would also be helpful
if you follow the templates for issue and pull request creation. Please follow thecontributing guidelines!Request and vote forAlexa features!CHANGELOG1.0.0Initial release of ask sdk local debugger package.1.1.0This release contains the following changes :region support in local debug invoker.