alexa / ask-toolkit-for-vscode

ASK Toolkit is an extension for Visual Studio Code (VSC) that that makes it easier for developers to develop and deploy Alexa Skills.
https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/get-started-with-the-ask-toolkit-for-visual-studio-code.html
Apache License 2.0
108 stars 52 forks source link

Unbound Breakpoint when using local debugging #106

Closed halykon closed 3 years ago

halykon commented 3 years ago

Describe the bug Breakpoints aren't getting bound after starting the debug session. I set up a new Skill, added the local debugging packages and added a launch.json. The debugging session starts and logs are being printed out, but breakpoints aren't hit.

To Reproduce

  1. Create a new Skill using ASK CLI
  2. Add local debugging packages (ask-sdk-local-debug and ask-sdk-model)
  3. Use extension to generate a launch.json
  4. Set Breakpoint and start debugging
  5. Breakpoint doesn't get bound (is grayed out and labeled as "Unbound Breakpoint")

Extension Logs

[info - 2021-03-02 16:05:16.545Z] Activating extension 
[info - 2021-03-02 16:05:17.234Z] The Alexa Skills Kit extension has been updated. 
[info - 2021-03-02 16:05:20.101Z] skill package schema has been updated. 
[info - 2021-03-02 16:05:20.103Z] SkillPackageWatcher is started 
[info - 2021-03-02 16:12:02.334Z] log level changed to verbose 
[debug - 2021-03-02 16:12:23.732Z] Calling method: ask.debugAdapterPath, args: [{"name":"Debug Alexa Skill (Node.js)","type":"node","request":"launch","program":"${command:ask.debugAdapterPath}","args":["--accessToken","${command:ask.accessToken}","--skillId","${command:ask.skillIdFromWorkspace}","--handlerName","handler","--skillEntryFile","/path/to/my/project/folder/lambda/index.js","--region","EU"],"cwd":"/path/to/my/project/folder/lambda","__configurationTarget":5,"noDebug":true,"__debuggablePatterns":["*.js","*.es6","*.jsx","*.mjs"],"__workspaceFolder":"/path/to/my/project/folder"}]
[debug - 2021-03-02 16:12:25.281Z] Successfully uploaded telemetry data. 
[debug - 2021-03-02 16:12:27.337Z] Successfully uploaded telemetry data. 
[verbose - 2021-03-02 16:12:27.344Z] Calling method: checkProfileSkillAccess 
[verbose - 2021-03-02 16:12:27.344Z] Calling method: getSkillProfile 
[verbose - 2021-03-02 16:12:27.344Z] Calling method: getSkillFolderInWs 
[verbose - 2021-03-02 16:12:27.344Z] Calling method: doesWorkSpaceExist 
[verbose - 2021-03-02 16:12:27.344Z] Calling method: getAskResourceConfig 
[verbose - 2021-03-02 16:12:27.347Z] Calling method: getSkillDetailsFromWorkspace 
[verbose - 2021-03-02 16:12:27.347Z] Calling method: getSkillFolderInWs 
[verbose - 2021-03-02 16:12:27.347Z] Calling method: doesWorkSpaceExist 
[verbose - 2021-03-02 16:12:27.347Z] Calling method: getAskResourceConfig 
[verbose - 2021-03-02 16:12:27.347Z] Calling method: getAskState 
[verbose - 2021-03-02 16:12:27.348Z] Calling method: getSkillManifestFromWorkspace 
[verbose - 2021-03-02 16:12:27.348Z] Calling method: getSkillMetadataSrc 
[verbose - 2021-03-02 16:12:27.348Z] Calling method: getAskResourceConfig 
[verbose - 2021-03-02 16:12:27.349Z] Calling method: getSkillNameFromLocales, args: [{"en-US":{"summary":"Sample Short Description","examplePhrases":["Alexa open hello world","hello","help"],"name":"debug-test-julian","description":"Sample Full Description"}},null]
[debug - 2021-03-02 16:12:28.824Z] Successfully uploaded telemetry data. 

Expected behavior

Breakpoint should be bound and getting hit when code is executed.

Screenshots image

Desktop (please complete the following information):

Additional context N/A

nikhilym commented 3 years ago

Hey @halykon , I just tried the steps and couldn't reproduce this issue. I am guessing it is something to do with your launch.json file, since the debug info you pasted mentions the incorrect arguments "--skillEntryFile","/path/to/my/project/folder/lambda/index.js" .

Can you please paste your debug.json file here ? Also, on running the debugger, do you get a debugger instance running on the skill?

halykon commented 3 years ago

Hey there @nikhilym I replaced the file path in the log dump since it contains sensitive information, sorry i didn't mention that.

Here's my launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug Alexa Skill (Node.js)",
      "type": "node",
      "request": "launch",
      "program": "${command:ask.debugAdapterPath}",
      "args": [
        "--accessToken",
        "${command:ask.accessToken}",
        "--skillId",
        "${command:ask.skillIdFromWorkspace}",
        "--handlerName",
        "handler",
        "--skillEntryFile",
        "${workspaceFolder}/lambda/index.js",
        "--region",
        "EU"
      ],
      "cwd": "${workspaceFolder}/lambda"
    }

  ]
}

please let me know if i need to provide anything more, i just started working with my company and thus i am completely new to Alexa skills.

I'll try setting up a skill in windows today, since breakpoints work for my coworker who's using windows.

Edit: Alright, i now set up the skill in windows and everything worked out fine. Breakpoints getting bound and are hitting. Seems like Apple Silicon is the issue here, since i used the exact same project with the exact same setup.

nikhilym commented 3 years ago

Thanks @halykon . That's interesting to know. I don't think we have any processing on the service side regarding the system being used by the skill developer, but I'll still check around with the team.

Can you please provide us with the following info, through your M1 machine :

sattpat commented 3 years ago

Hey @halykon , did you make any code changes once you started the debugging session. At times I have observed that leaves the debug map info in a bad state. It would also help to check in on this vscode ticket for possible workarounds - https://github.com/microsoft/vscode/issues/102493 You can also try removing all breakpoints, restart your debug session and set the breakpoints again.

I hope this helps.

halykon commented 3 years ago

Hey @halykon , did you make any code changes once you started the debugging session. At times I have observed that leaves the debug map info in a bad state. It would also help to check in on this vscode ticket for possible workarounds - microsoft/vscode#102493 You can also try removing all breakpoints, restart your debug session and set the breakpoints again.

I hope this helps.

Hey @sattpat , no i didn't make any code changes once the debug session started, and removing breakpoints and restarting didn't work either. I also tried restarting the machine which didn't work. Setting debug.javascript.usePreview to false as suggested in microsoft/vscode#102493 will result in breakpoints binding but still not getting hit.

I think i'll try wiping vscode next, so i can try again in clean environment.

@nikhilym

Can you please provide us with the following info, through your M1 machine :

  • Skill ID
  • Timestamps when you were trying to debug the skill
  • Debug Console output when you start debugging the skill

Sure thing:

Session will last for 1 hour

Skill request { "type": "SkillRequestMessage", "version": "1.0", "requestId": "wsds-transport-requestId.v1.AAAAAAAAAAD/8kJ3sNjyp2fet21wNnd+sAAAAAAAAAAeTAmyJ8Ll55ejKpQHsD0RrqTNe36Af6WjUyn0rI2AmGlOKO8aE2EWezTomPS9A8N+0/BAQ6swuk4QSGqW7woQYKhsCfe7vj5oXbJCdHn7/wi0HWtzVRH+M/tzQvyxK96Hq3E72Z8yhgYLS2ZaUUiAUBRgcvCqqRWW2zWv/xGF/rJTDL4iQbJIT2gdCSvwdGCPO/9UkAa3FOwomMFbm+Ew5aE3rmyXvBoPsH5WWd7oKg==", "requestPayload": "{\"version\":\"1.0\",\"session\":{\"new\":false,\"sessionId\":\"amzn1.echo-api.session.ca4fe776-946f-4b2d-91a7-c98c63f28c30\",\"application\":{\"applicationId\":\"amzn1.ask.skill.009521b6-8ada-4e58-96ad-05452e919a92\"},\"user\":{\"userId\":\"amzn1.ask.account.AEFSBJJ6BBVHN6WDWGDQIPTPE75VMLV6AEOCVOILQKYLIML6SPSVPUYKM57ZIHFSOFTCP37XV637IUHUITIK5IWZ2PTCQARSNLJFICE5XMF2PAGR6ZU3YNJA77YUNEVQWOOIAAKHCMYFCDTJTNJMKTTRXFLFPJYS7RGJROAASR7HTT7HOLCE35SR6NFPMHWQ7XO7QIYOBMS35NQ\"}},\"context\":{\"Extensions\":{\"available\":{\"aplext:backstack:10\":{}}},\"System\":{\"application\":{\"applicationId\":\"amzn1.ask.skill.009521b6-8ada-4e58-96ad-05452e919a92\"},\"user\":{\"userId\":\"amzn1.ask.account.AEFSBJJ6BBVHN6WDWGDQIPTPE75VMLV6AEOCVOILQKYLIML6SPSVPUYKM57ZIHFSOFTCP37XV637IUHUITIK5IWZ2PTCQARSNLJFICE5XMF2PAGR6ZU3YNJA77YUNEVQWOOIAAKHCMYFCDTJTNJMKTTRXFLFPJYS7RGJROAASR7HTT7HOLCE35SR6NFPMHWQ7XO7QIYOBMS35NQ\"},\"device\":{\"deviceId\":\"amzn1.ask.device.AHGZIDGWZVEAB2JLM7ZH5X3TIIOTMQUW76LFAOHJWH4O2Q2D7OTAF4ACFHLTCYQIHMNRSJJQAON7VMOIO3RG3AE7Y7SQJVTSYGS34JZBX3S4IJS4OOGUONC6PPS3SBDS3DBBP6DVWDQLSJ7VBJMTL6ICEBXY33FXR7XHYAH4UISFESCE4QCMQ\",\"supportedInter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ZMRkFPSEpXSDRPMlEyRDdPVEFGNEFDRkhMVENZUUlITU5SU0pKUUFPTjdWTU9JTzNSRzNBRTdZN1NRSlZUU1lHUzM0SlpCWDNTNElKUzRPT0dVT05DNlBQUzNTQkRTM0RCQlA2RFZXRFFMU0o3VkJKTVRMNklDRUJYWTMzRlhSN1hIWUFINFVJU0ZFU0NFNFFDTVEiLCJ1c2VySWQiOiJhbXpuMS5hc2suYWNjb3VudC5BRUZTQkpKNkJCVkhONldEV0dEUUlQVFBFNzVWTUxWNkFFT0NWT0lMUUtZTElNTDZTUFNWUFVZS001N1pJSEZTT0ZUQ1AzN1hWNjM3SVVIVUlUSUs1SVdaMlBUQ1FBUlNOTEpGSUNFNVhNRjJQQUdSNlpVM1lOSkE3N1lVTkVWUVdPT0lBQUtIQ01ZRkNEVEpUTkpNS1RUUlhGTEZQSllTN1JHSlJPQUFTUjdIVFQ3SE9MQ0UzNVNSNk5GUE1IV1E3WE83UUlZT0JNUzM1TlEifX0.Eio4CoSuY4QZElvaVuFiwgCKJXKbtiHWrxenBB3gI3w-24M-zm0jCY6zWlJtmv1-Xzmojy-wyeXmJelx9XrzgGeA8GfwjI6Gcp5u4vyIZMpYyzS57hkh8McB6U7fL-Sh9vfjjeLyILwC0tjYrLuckynSV9WpiJ3kIwzW2PsPMgCxZ0AG7w8BshVPAtcuPIqgIg27wV5TAxy7aDOZDYpplFDCQ9EXlZnXgCVoQRHILHbdd3zFmBJ2rZno7mxKLahLI-O97DundtkOck3hU7Y5d7so_QDtHXrZp9QQWK4sWtKFVDlq8_uKVkzpdZpPRjYggHGyAa-Hq4maAuG5OQ2ZTA\"}},\"request\":{\"type\":\"IntentRequest\",\"requestId\":\"amzn1.echo-api.request.95bfd4f0-6b2d-4e3b-9fef-154ee41941ec\",\"locale\":\"en-US\",\"timestamp\":\"2021-03-04T09:51:27Z\",\"intent\":{\"name\":\"HelloWorldIntent\",\"confirmationStatus\":\"NONE\"}}}" }

Skill response { "type": "SkillResponseSuccessMessage", "originalRequestId": "wsds-transport-requestId.v1.AAAAAAAAAAD/8kJ3sNjyp2fet21wNnd+sAAAAAAAAAAeTAmyJ8Ll55ejKpQHsD0RrqTNe36Af6WjUyn0rI2AmGlOKO8aE2EWezTomPS9A8N+0/BAQ6swuk4QSGqW7woQYKhsCfe7vj5oXbJCdHn7/wi0HWtzVRH+M/tzQvyxK96Hq3E72Z8yhgYLS2ZaUUiAUBRgcvCqqRWW2zWv/xGF/rJTDL4iQbJIT2gdCSvwdGCPO/9UkAa3FOwomMFbm+Ew5aE3rmyXvBoPsH5WWd7oKg==", "version": "1.0", "responsePayload": "{\"version\":\"1.0\",\"response\":{\"outputSpeech\":{\"type\":\"SSML\",\"ssml\":\"Hello World!\"}},\"userAgent\":\"ask-node/2.10.1 Node/v14.16.0\",\"sessionAttributes\":{}}" }

halykon commented 3 years ago

Hey @nikhilym I can now confirm that this is indeed an Apple Silicon issue. I just installed the VSCode Intel built, tried debugging using it and lo and behold it works flawlessly.

nikhilym commented 3 years ago

Very interesting. Thanks for the update @halykon . The latest vscode stable release apparently adds support for Apple Silicon, though I do not see any specific debugger improvements. Neither do I see any open/closed bugs on debugger on vscode github repo, but I might be missing something.

Since this is outside the scope of this extension, and since you are unblocked, I am going ahead and closing this issue. Please reopen if you are facing problems with local debugging or have other questions. Thanks.