Log HTTP requests

The idea is:

Logging HTTP requests server-side using an environment variables.

My use case:

Debugging HTTP requests created by nodes. This is extremely useful for nodes that connects to complex APIs.

I think it would be beneficial to add this because:

This would vastly improve the debugging experience for developers.

For example, I’ve hit a tiny bug in the Google Calendar node, leading to a “400 Bad request” response: Google Calendar node fails with Luxon-formatted date from Google Sheets (works with hardcoded string)

But I don’t have enough visibility to debug it because I can’t see the HTTP request.

Any resources to support this?

N8n is using Axios under the hood. Logging is setup using an interceptor, basically just a tiny function that logs the request.

Previous question on this topic:

This feature used to exist indirectly when N8n was using request-promise, but Axios doesn’t have logging enabled via an environment variable out of the box, so n8n can’t do that either anymore.

Other related discussion: Is there a way to inspect the actual http requests in n8n?
It would rely on setting up a convoluted observability system by proxying HTTP requests, that’s not realistic for most users even advanced.

Are you willing to work on this?

Yes I can contribute to the n8n codebase.

For implementation, the logging Axios interceptor would be attached when “N8N_LOG_HTTP_REQUESTS” is “1” for instance.

The relevant file in the codebase is : packages/core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts