HTTP Request node fails with "config.headers.setContentType is not a function" when calling api.openai.com

HTTP Request node fails with “config.headers.setContentType is not a function” when calling api.openai.com

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @erezeloi

This is an issue which the n8n team is aware.
Keep a lookout for any update

@erezeloi this is the openai.com URL interceptor bug on Cloud 2.19.x, every path through n8n’s request helper hits it. only unblock right now is proxying through a Cloudflare Worker so the URL isn’t api.openai.com:

``
export default { async fetch(req) { const u = new URL(req.url); u.host = ‘api.openai.com’; u.protocol = ‘https:’; return fetch(new Request(u, req)); } }
`

then point the HTTP node at https://yourworker.workers.dev/v1/…`, auth header passes through fine.

@erezeloi Welcome to the community! You’re hitting a known bug on n8n Cloud 2.19.x that the team is actively working on.

While waiting for the fix, here’s a simpler workaround than the Cloudflare proxy if your use case allows it:

Use HTTP Request node with Header Auth instead of the OpenAI credential:

  1. Add an HTTP Request node
  2. Method: POST
  3. URL: https://api.openai.com/v1/chat/completions
  4. Authentication: Header Auth
  5. Header Name: Authorization, Value: Bearer sk-YOUR-API-KEY
  6. Body Content Type: JSON, with your payload

This bypasses the broken axios interceptor entirely and connects fine. The output JSON format is identical to what the OpenAI node returns. Once the official fix ships, you can swap back to the native credential.

Hope this unblocks you!