Debugging

View Markdown

Last edited on 2026-08-24

Local Debugging of Cloud Functions

Cloud Development provides a local debugging feature for cloud functions. It offers a local Node.js cloud function runtime environment that is consistent with the online production environment, allowing developers to debug cloud functions locally. Using local debugging can improve development and debugging efficiency:

  • Step-by-step/Breakpoint Debugging: Compared to debugging by checking online logs in the Cloud Development Console, local debugging enables step-by-step and breakpoint debugging for the local Node.js cloud function instance.
  • Integrated Mini Program Testing: If interactions or clicks in the simulator trigger a cloud function with local debugging enabled, the request will be routed to the local instance instead of the cloud.
  • Optimized Development Workflow and Improved Efficiency: During the debugging phase, there is no need to upload and deploy cloud functions. Compared to the standard debugging process without local debugging ("Local Code Modification -> Upload & Deploy Cloud Function -> Invoke"), the local debugging workflow eliminates the upload waiting time, changing the process to simply "Local Modification -> Invoke". This significantly improves development and debugging efficiency.

Additionally, local debugging offers customized debugging capabilities, including a Network panel that displays HTTP requests and Cloud Development requests, call relationship graphs, and hot reloading when local code is modified, helping developers better develop and debug cloud functions. See below for a detailed introduction to these features.

It is recommended that developers use local debugging to test and pass validation before uploading code and deploying to the production environment.

For more detailed documentation, click here.

Network Panel

Starting from WeChat DevTools 1.02.1905302 and Base Library 2.7.1, Cloud Development requests (calls to database, Cloud Functions, file storage, etc.) will be displayed in the Mini Program Network panel. When presented in the Network panel, the API name is shown (except for wx.cloud.uploadFile and wx.cloud.downloadFile). A special request type cloud is used, which displays the actual environment ID of the request, the request body (database call request bodies are displayed in SDK syntax), the JSON response, the time taken, and the call stack.

Note: The implementation of Cloud Development APIs in DevTools differs from that on client devices. The latency in DevTools is generally higher than on client devices. Our tests in specific environments show that client devices are approximately 33% faster than DevTools.

Here is an example:

devtools-cloud-network

Example of database call details:

devtools-cloud-network

Example of response:

devtools-cloud-network

Environment Notice

Starting from WeChat DevTools version 1.02.1905302 and Base Library 2.7.1, in the Mini Program debugger, if wx.cloud.init is used, the default invocation environment configured in Mini Program will be output in the debugger.

devtools-network-cloud-init