Debug a locally running service in Cloud Code for IntelliJ
Stay organized with collections
Save and categorize content based on your preferences.
With Cloud Code, you can debug your Cloud Run services
locally in a Cloud Run-like environment. You can set breakpoints, step through
your code, and debug remote services running in containers.
With Cloud Code, you can set breakpoints and
debug remote applications running in containers for the following languages:
Java
Cloud Code automatically adds an environment variable,
JAVA_TOOL_OPTIONS, with the appropriate JDWP configuration to
enable debugging. If JAVA_TOOL_OPTIONS is already present,
Cloud Code uses existing settings specified in
JAVA_TOOL_OPTIONS.
Node.js
Depending on the structure of your application and its image build
configuration, you might have to help the debugger map your local sources
to the remote sources in the container. This enables the Node debugger
to correctly process your breakpoints.
You can configure this in one of the following ways:
Manual configuration
Select the Cloud Run: Run Locally Run Configuration from the dropdown
and then click Edit Configurations. On the Debug tab, configure the
source mapping from your local application source to the source
location in the remote container.
Configuration options:
File/directory - the local file or directory of your application
running on Cloud Run.
Remote path - the path to the file or directory running in the
container on Cloud Run.
Automatic configuration
You can choose to defer this mapping to Cloud Code. When you
start your debug session, Cloud Code attempts to infer
this mapping automatically. The inferred mapping is presented to you in a
dialog; one dialog for each artifact you are debugging.
Configuration options:
Local path - the local path to the root of the artifact you
are debugging.
Remote path - the path to the file or directory running in the
container on Cloud Run. You can choose to
override this with your own value. If you click
Cancel, no mapping is applied.
Go
To configure your application for debugging, your app must be a
Go Module-based application
and be identified as being Go-based by setting one of the
standard Go runtime environment variables
in the container, such as GODEBUG, GOGC, GOMAXPROCS, or
GOTRACEBACK. GOTRACEBACK=single is the default setting for Go
and GOTRACEBACK=all is a generally useful configuration.
Optionally (but recommended), your app should be built with the
-gcflags='all=-N -l' options to disable optimizations. Skaffold
Profiles are a useful
option for this purpose and can be set with the Deployment Profile
field in your Run configuration on the Build/Deploy tab.
Python
To configure your application for debugging, ensure you meet the following
prerequisites:
IDE, edition, and plugin are compatible
For compatible IDEs, editions, and plugins, see
Supported IDEs.
Skaffold version is 1.25.0 or greater
You can allow Cloud Code to manage your dependencies,
or point to a local Skaffold installation. See Preferences > Tools >
Cloud Code > Dependencies.
Python interpreter is configured
Without a Python interpreter configured in your project,
debugging won't work, as there is no way to run pydevd, the
underlying Python debugger.
IDE
How to configure
IntelliJ IDEA
Python debugging with Cloud Code requires a
Python SDK to be configured for your project.
Go to File
> Project Structure and add a Python SDK in the Project
tab. If none exists, add one under the SDK tab.
PyCharm
Go to File > Settings > Project > Python Interpreter or
for Mac OS X, PyCharm > Preferences > Project > Python
Interpreter, and add a Python interpreter.
To submit feedback or report an issue in your IntelliJ IDE, go to
Tools > Cloud Code > Help / About > Submit
feedback or report an issue to report an issue on GitHub.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eCloud Code allows local debugging of Cloud Run services in a Cloud Run-like environment, enabling users to set breakpoints, step through code, and debug remote services running in containers.\u003c/p\u003e\n"],["\u003cp\u003eDebugging a service requires creating a debug configuration by selecting "Cloud Run: Run Locally" under "Cloud Code: Cloud Run" in the Run/Debug configurations.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code supports debugging for Java, Go, Node.js, and Python, with specific IDEs and plugin requirements detailed for each language.\u003c/p\u003e\n"],["\u003cp\u003eNode.js debugging may require manual or automatic source mapping to align local and remote sources, while Go applications need to be Go Module-based and may benefit from specific build options.\u003c/p\u003e\n"],["\u003cp\u003ePython debugging requires a Python SDK configured within your project's IDE, and it also requires a skaffold version of 1.25.0 or greater.\u003c/p\u003e\n"]]],[],null,["# Debug a locally running service in Cloud Code for IntelliJ\n\n| **Note:** Debugging support is currently available for Java, Go, Node.js, and Python services.\n\nWith Cloud Code, you can debug your Cloud Run services\nlocally in a Cloud Run-like environment. You can set breakpoints, step through\nyour code, and debug remote services running in containers.\n\nCloud Code also enables you to [debug an application while making\nchanges to, and iterating on, source code](/code/docs/intellij/watch-modes#applying-changes-while-debugging).\n\nDefining your debug configuration\n---------------------------------\n\nBefore you debug your service, you must create your debug configuration:\n\n1. Navigate to **Run/Debug** configuration selector in the Navigation bar and click **Edit Configurations**.\n2. Choose **Cloud Run: Run Locally** under **Cloud Code: Cloud Run**.\n3. Click **OK**.\n\nDebugging your service\n----------------------\n\nTo debug your service, follow these steps:\n\n1. Click\n **Debug** for **Cloud Run: Run Locally** to start the development cycle in\n debug mode.\n\n2. Cloud Code will attach a debug session. Once successful, the Debug Tool\n window opens, confirming connection (within the Console tab).\n\n3. Click the gutter at the executable line of the code where you want to\n add a breakpoint.\n\n Red filled circles denote active breakpoints, while red-outlined hollow\n circles signify disabled breakpoints.\n4. To access your running service, click the URL displayed in your Event Log panel.\n\n When you do, a new request is sent to your service and it pauses at the\n breakpoint-marked line.\n\n5. To end the debugging session, click the stop icon on the\n Cloud Run: Run Locally run configuration.\n\nSupported IDEs\n--------------\n\nThe following table lists the languages and IDEs that Cloud Code supports for\ndebugging. The table also lists the required plugins, where applicable:\n\nFor more information about IDE support, see\n[Supported JetBrains IDEs](/code/docs/intellij/ides).\n\nWith Cloud Code, you can set breakpoints and\ndebug remote applications running in containers for the following languages: \n\n### Java\n\nCloud Code automatically adds an environment variable,\n`JAVA_TOOL_OPTIONS`, with the appropriate JDWP configuration to\nenable debugging. If `JAVA_TOOL_OPTIONS` is already present,\nCloud Code uses existing settings specified in\n`JAVA_TOOL_OPTIONS`.\n\n### Node.js\n\nDepending on the structure of your application and its image build\nconfiguration, you might have to help the debugger map your local sources\nto the remote sources in the container. This enables the Node debugger\nto correctly process your breakpoints.\n\nYou can configure this in one of the following ways:\n\n- **Manual configuration**\n\n Select the **Cloud Run: Run Locally** Run Configuration from the dropdown\n and then click **Edit Configurations** . On the **Debug** tab, configure the\n source mapping from your local application source to the source\n location in the remote container.\n\n Configuration options:\n - **File/directory** - the local file or directory of your application running on Cloud Run.\n - **Remote path** - the path to the file or directory running in the container on Cloud Run.\n- **Automatic configuration**\n\n You can choose to defer this mapping to Cloud Code. When you\n start your debug session, Cloud Code attempts to infer\n this mapping automatically. The inferred mapping is presented to you in a\n dialog; one dialog for each artifact you are debugging.\n\n Configuration options:\n - **Local path** - the local path to the root of the artifact you are debugging.\n - **Remote path** - the path to the file or directory running in the container on Cloud Run. You can choose to override this with your own value. If you click **Cancel**, no mapping is applied.\n\n | **Note:** Automatic mapping is a best effort guess based on heuristics.\n\n### Go\n\nTo configure your application for debugging, your app must be a\n[Go Module](https://blog.golang.org/using-go-modules)-based application\nand be identified as being Go-based by setting one of the\n[standard Go runtime environment variables](https://godoc.org/runtime)\nin the container, such as `GODEBUG`, `GOGC`, `GOMAXPROCS`, or\n`GOTRACEBACK`. `GOTRACEBACK=single` is the default setting for Go\nand `GOTRACEBACK=all` is a generally useful configuration.\n\nOptionally (but recommended), your app should be built with the\n`-gcflags='all=-N -l'` options to disable optimizations. Skaffold\n[Profiles](https://skaffold.dev/docs/environment/profiles/) are a useful\noption for this purpose and can be set with the **Deployment Profile**\nfield in your Run configuration on the **Build/Deploy** tab.\n\n### Python\n\nTo configure your application for debugging, ensure you meet the following\nprerequisites:\n\n- **IDE, edition, and plugin are compatible**\n\n For compatible IDEs, editions, and plugins, see\n [Supported IDEs](#supported_ides).\n- **Skaffold version is 1.25.0 or greater**\n\n You can allow Cloud Code to [manage your dependencies](/code/docs/intellij/install#managed_dependencies),\n or point to a local Skaffold installation. See **Preferences \\\u003e Tools \\\u003e\n Cloud Code \\\u003e Dependencies**.\n- **Python interpreter is configured**\n\n Without a Python interpreter configured in your project,\n debugging won't work, as there is no way to run `pydevd`, the\n underlying Python debugger.\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\nFor more information, see the [Skaffold debug\ndocumentation](https://skaffold.dev/docs/workflows/debug/).\n\nGet support\n-----------\n\nTo submit feedback or report an issue in your IntelliJ IDE, go to **Tools** \\\u003e **Cloud Code** \\\u003e **Help / About** \\\u003e **Submit\nfeedback or report an issue** to report an issue on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues)."]]