OpenAI credential fails in n8n Cloud with "config.headers.setContentType is not a function"

Describe the problem/error/question

What is the error message (if any)?

Couldn’t connect with these settings

config.headers.setContentType is not a function

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:

This issue is known to the n8n team.
Keep a lookout for updates

@rayo axios interceptor bug — every call to api.openai.com hits the broken global helper, cred type doesn’t matter. only unblock is a Cloudflare Worker proxy:

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)); } }

point HTTP Request URL at https://yourworker.workers.dev/v1/chat/completions, auth header passes through

@rayo Good that @kjooleng confirmed it’s a known issue! While the n8n team works on the fix, here’s a simpler immediate workaround if you don’t want to set up a Cloudflare proxy:

Use an HTTP Request node directly 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: set to Header Auth
  5. Header Name: Authorization, Header Value: Bearer YOUR_API_KEY
  6. Body: JSON with your model, messages, etc.

This bypasses the broken credential type entirely and works fine in n8n Cloud right now. The output is the same as what the OpenAI node returns. You can swap back to the native node once the fix ships.

Hope this helps you unblock while waiting for the update!

This looks like a confirmed n8n Cloud bug rather than an issue with your OpenAI API key or setup. Multiple users are reporting the same config.headers.setContentType is not a function error after recent cloud updates, especially with OpenAI credentials and HTTP Request nodes. (n8n Community)

For now, your best option is probably:

  • Open a support ticket with n8n

  • Include your n8n version, workspace URL, and the exact error

  • Reference the existing GitHub issue so support can link it faster

Some users mentioned using the HTTP Request node as a temporary workaround until the fix is released. (n8n Community)

Funny enough, bugs like this always seem to appear right when someone is automating something important like a university admission workflow