adobe / aio-cli-plugin-runtime

Adobe I/O Runtime plugin for the Adobe I/O CLI
https://www.adobe.io
Apache License 2.0
15 stars 31 forks source link

Unable to debug runtime action from vscode because of invalid '.vscode/launch.json'. #244

Closed sgera closed 3 years ago

sgera commented 3 years ago

Describe the bug Unable to debug runtime action from vscode because of invalid '.vscode/launch.json'.

On creating an extension of type "Experience Cloud Shell Extension Point" using aio-cli (steps here)and launching the debugger from vscode (steps here), vscode is throwing the following error -

Error: ENOENT: no such file or directory, stat '/Users/sagera/work/azureservicebus-events-connector/Users/sagera/work/azureservicebus-events-connector/src/dx-excshell-1/actions/message-queue-connector/index.js'
    at Object.statSync (fs.js:1127:3)
    at Object.statSync (/Users/sagera/work/azureservicebus-events-connector/node_modules/graceful-fs/polyfills.js:312:16)
    at mountAction (/Users/sagera/work/azureservicebus-events-connector/node_modules/@openwhisk/wskdebug/src/kinds/nodejs/nodejs.js:59:16)
    at resolveValue (/Users/sagera/work/azureservicebus-events-connector/node_modules/@openwhisk/wskdebug/src/invoker.js:45:16)
    at OpenWhiskInvoker.prepare (/Users/sagera/work/azureservicebus-events-connector/node_modules/@openwhisk/wskdebug/src/invoker.js:179:38)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Debugger.start (/Users/sagera/work/azureservicebus-events-connector/node_modules/@openwhisk/wskdebug/src/debugger.js:116:13)
    at async wskdebug (/Users/sagera/work/azureservicebus-events-connector/node_modules/@openwhisk/wskdebug/index.js:302:13) {
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: '/Users/sagera/work/azureservicebus-events-connector/Users/sagera/work/azureservicebus-events-connector/src/dx-excshell-1/actions/message-queue-connector/index.js'

This error is because of an issue in the generated '.vscode/launch.json' file. The error goes away when I make the following change in the "runtimeArgs" under "configuration":

Generated launch.json (which has the issue)

"configurations": [
    {
      "type": "pwa-node",
      "name": "Action:dx-excshell-1/message-queue-connector",
      "request": "launch",
      "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/wskdebug",
      "envFile": "${workspaceFolder}/.env",
      "timeout": 30000,
      "killBehavior": "polite",
      "localRoot": "${workspaceFolder}",
      "remoteRoot": "/code",
      "outputCapture": "std",
      "attachSimplePort": 0,
      "runtimeArgs": [
        "dx-excshell-1/message-queue-connector",
        "${workspaceFolder}/Users/sagera/work/azureservicebus-events-connector/src/dx-excshell-1/actions/message-queue-connector/index.js",
        "-v",
        "--disable-concurrency",
        "--kind",
        "nodejs:14"
      ]
    }

Fixed launch.json (The issue is fixed when "${workspaceFolder}" prefix is removed from the runtimeArgs.) See -

"configurations": [
    {
      "type": "pwa-node",
      "name": "Action:dx-excshell-1/message-queue-connector",
      "request": "launch",
      "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/wskdebug",
      "envFile": "${workspaceFolder}/.env",
      "timeout": 30000,
      "killBehavior": "polite",
      "localRoot": "${workspaceFolder}",
      "remoteRoot": "/code",
      "outputCapture": "std",
      "attachSimplePort": 0,
      "runtimeArgs": [
        "dx-excshell-1/message-queue-connector",
        "/Users/sagera/work/azureservicebus-events-connector/src/dx-excshell-1/actions/message-queue-connector/index.js",
        "-v",
        "--disable-concurrency",
        "--kind",
        "nodejs:14"
      ]
    }

To Reproduce Steps to reproduce the behavior:

  1. Create an extension of type "Experience Cloud Shell Extension Point" using aio-cli (steps here)
  2. Launch visual code debugging using the steps here - https://adobeio-codelabs-debugging--adobedocs.project-helix.page/?src=/lessons/lesson2.html
  3. We get the above error

Expected behavior We should not get any error and the debugger should get seamlessly attached to the action.

Screenshots If applicable, add screenshots to help explain your problem. Error logs - image

Error dialog - image

Logs from the error dialog -

Error processing launch: Error: Could not connect to debug target at http://127.0.0.1:53058: Could not find any debuggable target
at Object.retryGetNodeEndpoint (/private/var/folders/4w/bzr57xk93mq24rm9cz4bhcsr0000gn/T/AppTranslocation/B66ECF55-4919-45EA-A1F8-D0A9F170A431/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:2:1299140)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async t (/private/var/folders/4w/bzr57xk93mq24rm9cz4bhcsr0000gn/T/AppTranslocation/B66ECF55-4919-45EA-A1F8-D0A9F170A431/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:2:1333468)
at async P.launch (/private/var/folders/4w/bzr57xk93mq24rm9cz4bhcsr0000gn/T/AppTranslocation/B66ECF55-4919-45EA-A1F8-D0A9F170A431/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:2:1338155)
at async t.Binder.captureLaunch (/private/var/folders/4w/bzr57xk93mq24rm9cz4bhcsr0000gn/T/AppTranslocation/B66ECF55-4919-45EA-A1F8-D0A9F170A431/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:2:1131345)
at async t.Binder._launch (/private/var/folders/4w/bzr57xk93mq24rm9cz4bhcsr0000gn/T/AppTranslocation/B66ECF55-4919-45EA-A1F8-D0A9F170A431/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:2:1130890)
at async Promise.all (index 3)
at async t.Binder._boot (/private/var/folders/4w/bzr57xk93mq24rm9cz4bhcsr0000gn/T/AppTranslocation/B66ECF55-4919-45EA-A1F8-D0A9F170A431/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:2:1129942)
at async t.default._onMessage (/private/var/folders/4w/bzr57xk93mq24rm9cz4bhcsr0000gn/T/AppTranslocation/B66ECF55-4919-45EA-A1F8-D0A9F170A431/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:2:1222072)

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

shazron commented 3 years ago

This has been fixed, and a new release will be out tonight. See : https://github.com/adobe/generator-aio-app/pull/160