Skip to content

Commit

Permalink
Fix formatting of ask-sdk-local-debug README
Browse files Browse the repository at this point in the history
  • Loading branch information
daltonhuynh committed Jul 22, 2020
1 parent b99f064 commit 2b19b24
Showing 1 changed file with 39 additions and 45 deletions.
84 changes: 39 additions & 45 deletions ask-sdk-local-debug/README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,58 @@
# ASK SDK Local Debug (Node.js)

## About
ASK SDK Local Debug 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.

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: Feature is currently only available to customers in the NA region(https://developer.amazon.com/en-US/docs/alexa/custom-skills/develop-skills-in-multiple-languages.html#h2-multiple-endpoints).
> NOTE: If you have an Alexa developer account in a region outside of [North America](https://developer.amazon.com/en-US/docs/alexa/custom-skills/develop-skills-in-multiple-languages.html#h2-multiple-endpoints), there are additional prerequisites before you can test your local skill. Complete the instructions in the document [Setting Up Local Debugging in Other Regions](https://github.com/alexa/ask-toolkit-for-vscode/wiki/Setting-Up-Local-Debugging-In-Other-Regions), and then continue with the instructions that follow here.
## Installation

In your skill code folder (e.g. `lambda`), install the following dependencies along with rest of the dependencies in your package.json
```
`npm install --save ask-sdk-model@^1.28.1
``npm install --save-dev ask-sdk-local-debug
`
```bash
npm install --save ask-sdk-model@^1.28.1
npm install --save-dev ask-sdk-local-debug
```

## Configuration

### USING Alexa SKills toolkit for VS code

The [Alexa Skills Toolkit for Visual Studio](https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/get-started-with-the-ask-toolkit-for-visual-studio-code.html) offer integrated support for local debugging. To get started, please review our technical documentation on how to [Test your local Alexa skill](https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/vs-code-ask-skills.html#test) using VS Code.
### Using with Alexa SKills Toolkit for VS Code

The [Alexa Skills Toolkit for Visual Studio](https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/get-started-with-the-ask-toolkit-for-visual-studio-code.html) offers integrated support for local debugging. To get started, please review our technical documentation on how to [Test your local Alexa skill](https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/vs-code-ask-skills.html#test) using VS Code.

> 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.
> 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, re-run `ask configure` to re-authorize your profile for local debugging.
### USING with other IDEs and Debuggers
### Using with other IDEs and Debuggers

1. To instantiate a connection to the local debugging service, execute the following from your skill’s `lambda` directory:
```
node ./node_modules/ask-sdk-local-debug/dist/LocalDebuggerInvoker.js
--accessToken <ACCESS_TOKEN>
--skillID <SKILL_ID>
--skillEntryFile <FILE_NAME>
--handlerName <HANDLER_NAME>
```
1. ACCESS_TOKEN:
1. Install ASK CLI v2
2. npm install ask-cli@2 -g
3. Generate the accessToken using ASK CLI
4. ask util generate-lwa-tokens --scopes alexa::ask:skills:debug
5. You will be directed to a Login with Amazon page. Sign in and retrieve your ACCESS_TOKEN from the terminal.
2. 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.
3. FILE_NAME: The path to your skill code's main file (typically `index.js`). This file or module contains the skill's handler function.
4. HANDLER_NAME: The exported handler method (typically `handler`). For example, please see the [Hello world example](https://github.com/alexa/skill-sample-nodejs-hello-world/blob/master/lambda/custom/index.js#L159).
3. 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": "node",
"request": "launch",
"name": "Skill Debug",
"program": "<5. Program>",
"args": [
"--accessToken","<ACCESS_TOKEN>",
"--skillId", "<SKILL_ID>",
"--skillEntryFile", "<FILE_NAME>",
"--handlerName" , "<HANDLER_NAME>"
]
}
```
```bash
node ./node_modules/ask-sdk-local-debug/dist/LocalDebuggerInvoker.js
--accessToken <ACCESS_TOKEN>
--skillID <SKILL_ID>
--skillEntryFile <FILE_NAME>
--handlerName <HANDLER_NAME>
```
* `ACCESS_TOKEN`:
1. Install ASK CLI v2: `npm install ask-cli@2 -g`
2. Generate the accessToken using ASK CLI `ask util generate-lwa-tokens --scopes alexa::ask:skills:debug`
3. 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.
* `FILE_NAME`: The path to your skill code's main file (typically `index.js`). This file or module contains the skill's handler function.
* `HANDLER_NAME`: The exported handler method (typically `handler`). For example, please see the [Hello world example](https://github.com/alexa/skill-sample-nodejs-hello-world/blob/master/lambda/custom/index.js#L159).

2. 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`:
```json
{
"type": "node",
"request": "launch",
"name": "Skill Debug",
"program": "<5. Program>",
"args": [
"--accessToken","<ACCESS_TOKEN>",
"--skillId", "<SKILL_ID>",
"--skillEntryFile", "<FILE_NAME>",
"--handlerName" , "<HANDLER_NAME>"
]
}
```

## Things to note

Expand Down

0 comments on commit 2b19b24

Please sign in to comment.