Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
S_SrinivasaRao
Newcomer

#Step by Step Remote Debugging SAP CAP Applications with-in Business Application Studio. 

Note: Wanted to keep my blogs are simple and point to the needs 🙂 Not adding much theory part 🙂 please refer the below blogs for about more theory and step by step approach. 

Reffered Blog 

1. Login to cloud foundry.

 

cf login -a <api-url> --sso 

 

2. Connect to a Cloud Foundry Application Instance Using SSH.

 

cf ssh-enabled <<deployed-capapplication-service>> or cf enable-ssh <<deployed-capapplication-service>>

 

image.png

 3. Enable the Node.js Inspector for Remote Debugging on Running CAP Application.

 

cf enable-ssh myapp

 

image.png

 4. Re-Start Running CAP Application

 

cf restart <<deployed-applicaion-service>>

 

5. Enable Port Forwarding to Cloud Foundry.

 

cf ssh <<deployed-application-service>>
once connected , you will be in an interactive SSH Session. 

 

5. Attach a Node.js Debugger to a Process Running on a Cloud Foundry Application Instance.

To enable debug mode for a running Node.js process, you'll need to determine its unique process ID (PID). On Linux and Unix-like environments, you can use the ps command to obtain this information.

 

ps aux

 

image.png

Once the PID of the Node.js process running the application is known, you can use the kill command to send a debugging signal to it. The Node.js runtime activates the inspector protocol when it receives a usr1 signal.

 

kill -usr1 189

 

image.png

 6. Enable Port Forwarding to Cloud Foundry, ( VIMP ) Command, Run In New Terminal 

 

cf ssh -N -L 9229:127.0.0.1:9229 <<deployed-application-service>>

 

7. Add Business Application Studio debug configuration. 

 

 {
      "name": "Remote Debugging",
      "port": 9229,
      "request": "attach",
      "type": "node",
      "localRoot": "${workspaceFolder}",
      "remoteRoot": "/home/vcap/app"
    },

 

8. Run the CAP Application. 

image.png

 

 

image.png

Thank You. 

1 Comment
Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Kudos

What is the reason for this blog? Is something wrong with the referenced content?