ask-toolkit-for-vscode icon indicating copy to clipboard operation
ask-toolkit-for-vscode copied to clipboard

Local debugging fails because of accessToken

Open MichaelBriggsFluidra opened this issue 2 years ago • 10 comments

Describe the bug

I am trying to set up local debugging.

I followed these instructions up to the point where I have the launch.json file shown in the screenshots below.

When I click Run>Start Debugging, it throws this error an error saying the access token is not recognized as an internal or external command. I think this has something to do with the pipe character | just after 'Atza'. See screenshots for the full error.29.png)

To Reproduce

Steps to reproduce the behavior:

  1. Create a new skill with Alexa Skills Toolkit
  2. Follow the instructions here to set up local debugging
  3. Open the Run menu and then choose Start Debugging.
  4. The error occurs

Screenshots

image image

Desktop:

  • OS: Microsoft Windows 10 Pro
  • Visual Studio Code Version: 1.68.1
  • Alexa Skill Toolkit Version: 2.11.1

MichaelBriggsFluidra avatar Jul 01 '22 01:07 MichaelBriggsFluidra

Just covering the basics here, are you sure you are logged in on the dev console?

https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/get-started-with-the-ask-toolkit-for-visual-studio-code.html#login

follow the steps under Sign in to your Amazon developer account from VS Code.

doiron avatar Jul 01 '22 22:07 doiron

hmm looking at the command it's trying to run it seems the access token is setup with a pipe char | and the command prompt appears to treat the remainder of the command as a new command... and hence the error that the command doesn't exist..

doiron avatar Jul 01 '22 22:07 doiron

could you try updating the configuration to encapsulate the accesstoken param with single or double quotes?

ie.

"args" : [
   "--accessToken",
   "'#{command:ask.accessToken}'",
    ...

]

doiron avatar Jul 01 '22 23:07 doiron

Yep I am logged in on the dev console.

I tried encapsulating the accesstoken with double/single quotes but I'm still getting the same error.

I think you are right about the pipe char, do you know if every accesstoken contains one? If so then the issue may be with the way my vs code debugger handles it. Otherwise could it be possible to generate an accesstoken that doesn't contain a pipe char?

MichaelBriggsFluidra avatar Jul 04 '22 00:07 MichaelBriggsFluidra

ok maybe try replacing pipe char with ^| somehow ? I'll try it out later but let me know if how that worked out! if so, that could potentially be done in the code as a fix eventually

doiron avatar Jul 04 '22 01:07 doiron

That worked! I copied the accesstoken that was printed in the error message and replaced | with ^| and the debugging session successfully started.

I am having another issue now though, the skill simulator isn't running off local files. Any changes I make aren't seen until I deploy the skill with git commit and git push , any breakpoints I set don't pause the code execution and skill inputs and outputs don't appear in the debug console.

MichaelBriggsFluidra avatar Jul 04 '22 04:07 MichaelBriggsFluidra

Hey @MichaelBriggsFluidra , I'm trying to narrow down what the root cause of the issue here is, I was wondering if you could try a couple things in your configuration? So far, I've not been able to produce this exact behavior, even using the same VSC version you listed above.

  • What terminal is listed as the default for you?

image

  • If you change the default terminal by using the Select Default Profile button in that dropdown, does it change the behavior for you?

  • Can you also try adding "console": "integratedTerminal" to the end of the launch.json configuration like below?

image

tydonelson avatar Jul 12 '22 22:07 tydonelson

I can also check on the skill simulator issue, but I'll have to get back to you on that.

tydonelson avatar Jul 12 '22 22:07 tydonelson

Hi @tydonelson

  • The powershell is set to default for me.
  • Changing the default terminal didn't seem to change anything.
  • Adding "console": "integratedTerminal" worked! This is the output in the terminal: Local-Debugging

MichaelBriggsFluidra avatar Jul 14 '22 07:07 MichaelBriggsFluidra

Thanks for checking on that, @MichaelBriggsFluidra ! Using "console": "integratedTerminal" is the best recommendation I have for now, we're working on getting some documentation updated around that exception for any Windows users running into the problem you're seeing. You should only have to add that line the first time you establish the launch.json skill debug configuration for a skill, so I hope it's not too painful of a workaround for now.

We are giving some thought to how to better resolve this in the future, but want to ensure that any change we make is passive and works with the many different O/S and shells that VSCode is compatible with.

tydonelson avatar Jul 15 '22 21:07 tydonelson

This issue is stale since it has been open for 60 days with no activity. Please respond or this issue will be closed soon.

github-actions[bot] avatar Sep 14 '22 01:09 github-actions[bot]

This stale issue has been closed now. Please reopen the issue if you are still having problems with the toolkit.

github-actions[bot] avatar Sep 21 '22 01:09 github-actions[bot]