> ## Content Index
> Fetch the complete content index at: https://airabbit.blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Mock and Monitor API Calls in n8n in Docker
- URL: https://airabbit.blog/how-to-mock-and-monitor-api-calls-in-n8n-in-docker-2/
- Published: 2024-11-09T19:36:11.000Z
- Updated: 2025-03-21T15:48:33.000Z
- Description: Debugging n8n workflows can be complex yet rewarding. This article guides you through effective debugging techniques, including tracing API calls and using logging streaming. By configuring Proxyman in Docker, you can monitor requests efficiently. Learn to mock and test your workflows to ensure t...
- Author: AiRabbit
- Tags: Automation, Development, Infrastructure, Tutorials

Workflows in **n8n** can be incredibly powerful, but they can also be complicated at times. As with any software system, good **debugging** skills are essential.

In this article, we'll look at how to effectively debug your n8n workflows.

Let’s dive in.

Let's say you're running a workflow with some **API calls** and you're not getting the results you expected. You can **trace the call** and look in the Chrome console to see the request like this:

You can also use **logging streaming** as described [here](https://docs.n8n.io/log-streaming/?ref=airabbit.blog). Please note that this feature is only available in the paid version.

Once you've identified the error, you may need to iterate through the workflow several times. If you're using APIs, this can get expensive, so **mocking and monitoring requests** is incredibly important for building your workflows quickly and cost-effectively.

## Configuring Proxyman with Docker

If you run **Proxyman** on the host and n8n on the same machine, it may work out of the box if Proxyman is configured correctly, as n8n would automatically pick up the system proxy. However, if you run it in a **Docker container** (and even worse, on a Mac), it can become cumbersome. So you need to explicitly tell the n8n container to use the Docker host proxy (Proxyman) when it starts.

You would then extend the Docker command like this. Note that you'll need to update your host's proxy port accordingly (by default it's **9090**, but I use **9091** because **9090** is in use):

```bash
docker run -d -it \
  --name n8n \
  -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  --env HTTP_PROXY=http://host.docker.internal:9091 \
  --env HTTPS_PROXY=http://host.docker.internal:9091 \
  --env NO_PROXY=localhost,127.0.0.1 \
  --add-host=host.docker.internal:host-gateway \
  docker.n8n.io/n8nio/n8n

```

Once that is done, the rest is easy. To set up the mock and trace the request, you need to follow these steps:

First, **create a local map (aka mockup)** and activate it.

![Create Local Map](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/11/image-68.png)

  
![Activate Mockup](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/11/image-69.png)

Next, **enable your proxy** to listen on the specified port that you configured when you started your Docker container.

![Enable Proxy](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/11/image-70.png)

Optionally, **add a filter** for the request you want to monitor.

![Add Filter](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/11/image-71.png)

# Testing it

Test it using any **HTTP request node** inside your n8n instance (running in Docker). Hit the test step.

![Test Step](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/11/image-76.png)

Finally, you should be able to see the **request and response** in Proxyman.

![Request and Response](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/11/image-73.png)

That's it.

Using this approach, you can **debug and mock** as many API calls as you like. When you have enough confidence, just turn off Proxyman and run on the live server and pray 😄.