diff --git a/tools/cds-cli.md b/tools/cds-cli.md index 83a35b322..5cda27092 100644 --- a/tools/cds-cli.md +++ b/tools/cds-cli.md @@ -546,23 +546,58 @@ There a couple of shortcuts and convenience functions: ::: -## Debugging with `cds debug` {.nodejs} +## Debugging with `cds debug` {#cds-debug} -`cds debug` lets you debug Node.js applications in Chrome DevTools running locally or in Cloud Foundry. +`cds debug` lets you debug applications running locally or remotely on Cloud Foundry. +Local applications will be started in debug mode, while (already running) remote applications are put into debug mode. -To debug remote applications in the currently targeted CF space, run: +To debug a application on Cloud Foundry, make sure +- to be logged in to the space where the application is deployed to, +- that you have developer permissions in the space +- that the app is running and [reachable through SSH](https://docs.cloudfoundry.org/devguide/deploy-apps/ssh-apps.html#check-ssh-permissions). + +Effectively, run: +```sh +cf login # select the correct org and space here +cf ssh-enabled # to check if SSH is enabled +``` + +::: tip Scale to one application instance only +We recommend to only scale to _one_ app instance on SAP BTP Cloud Foundry, as then your request is guaranteed to hit this one instance. +If you scale out to more instances, only some of your requests will hit the instance that the debugger is connected to. This can result in 'missed breakpoints'. + +However, it's possible to [route a request to a specific instance](https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#surgical-routing), which is useful if you can't reduce the number of app instances. +::: + + +### Node.js Applications + +#### Remote Applications + +To debug remote Node.js applications in the currently targeted CF space, run:
-$ cds debug bookshop-srv
+$ cds debug <app-name>
 
-Opening SSH tunnel for CF app 'bookshop-srv'
+Opening SSH tunnel on 9229:127.0.0.1:9229
 Opening Chrome DevTools at devtools://devtools/bundled/inspector.html?ws=...
+
+> Keep this terminal open while debugging.
 
This opens an [SSH tunnel](https://docs.cloudfoundry.org/devguide/deploy-apps/ssh-apps.html), puts the application in debug mode, and connects and opens the [debugger of Chrome DevTools](https://developer.chrome.com/docs/devtools/javascript).