There are plenty of tutorials on how to debug nodeJS applications locally on the web, including Chrome Developer Tools, Visual Studio Code, and widgets around NodeJS.
In a real world situation, we might have a situation where everything works fine locally but is deployed to a CloudFoundry production environment, where we need to directly debug a running NodeJS application in CloudFoundry. This article describes the detailed steps.
First we need a nodeJS application that works on CloudFoundry. For demonstration purposes, the application used in this article is Jerry-Demo-server:
Run the following command to SSH cf -n -t -l 9229:127.0.0.1:9229 jer-demo-server
This command establishes an SSH secure tunnel between the remote application’s port 9229 on CloudFoundry and the local port 9229.
Next, we type Chrome ://inspect into the Chrome address bar to see that the application running on CloudFoundry is ready for debugging locally:
Set breakpoints in the Chrome Developer Tools source code:
Then enter the url of the application again in the browser. The breakpoint is triggered and remote debugging can begin:
My blog is synchronized to tencent cloud + community, invite everyone to come together: cloud.tencent.com/developer/s…