

- #PHPSTORM DOCKER NODE DEBUG HOW TO#
- #PHPSTORM DOCKER NODE DEBUG FULL#
- #PHPSTORM DOCKER NODE DEBUG CODE#
The next step is to configure our package.json and nodemon.json files to allow for debugging. You'll notice that I bind port 9229 in my docker-compose.yaml file, this will be very applicable in the next steps so don't forget it! For future comparison, this is what the package.json and nodemon.json files look like in the backend folder before I set up the debugger, Enabling the Debugger in a Typescript ProjectĬool so we're set up with the docker-compose.yaml and Dockerfile and if you run docker-compose up -build you should see the system build and start up. So currently, my docker-compose.yaml and Dockerfile look as follows, You'll also see a devops folder where I keep the docker-compose.yaml file and the Dockerfile that should be used to build the backend code.įinally, I bind the backend/src directory into the docker container so that changes are picked up by nodemon during development and there's a quick project rebuild and restart without having to restart the docker container.
#PHPSTORM DOCKER NODE DEBUG CODE#
I'm using a nest project and I've placed the code into a backend folder. As long as you have docker and docker-compose installed, it should all work! If you'd like to follow in the example, you can clone the GitHub repository. I've used nest as our framework since that's what is most applicable in our use cases.
#PHPSTORM DOCKER NODE DEBUG HOW TO#
This article outlines how to set up debugging in a Typescript project that runs using docker containers. The tutorials were great but I couldn't find one that explained the process from start to finish, this article was what I worked off to get to this answer. So I started reading around and found that there are ways to bind to the debug ports for node projects. This means that the current solutions out there won't work for us, unless we want to run half of the stack through docker-compose and the other half directly on our PCs.
#PHPSTORM DOCKER NODE DEBUG FULL#
Furthermore, we use docker-compose, to set up the full stack for local development. We use docker for our development environment to ensure that there is a fast setup. The problem is that that solution assumes we are running the application directly off our PCs. It's pretty straight forward, all you have to do is set up the execution script in Webstorm (or any IDE really) and you're good to go. Instead, Tilt provides a standardized API for coordinating any debugger with your dev environment.I've recently been looking at how people debug Typescript applications. Of the examples in this guide use “magic” primitives. Tilt itself does not have any code for connecting to a particular debugger. (See this interactive snapshot for a closer look.) Connecting Your Own Debugger RemotePdb session open at 127.0.0.1:5555, waiting for connection … When using remote-pdb, the log line that tells you that your debugger is active is:ĬRITICAL:root:RemotePdb session open at 127.0.0.1:5555, waiting for connection … With the approach described here, the debugger doesn’t start until the first set_trace call, so don’t try to connect until then, or you’ll just see a bunch of errors.

Some debuggers start listening on their port as soon as the app starts, and you can connect immediately. (If you’d prefer to access your debugger in a browser instead of in your terminal/via TCP connection, check out our web-pdb example.) Remember to wait for your debugger (The remote-pdb guide has some other connection options, if you prefer.)
