OpenAI credentials fail on n8n Cloud 2.19.3 with config.headers.setContentType is not a function

Hi everyone,
I’m having an issue connecting my OpenAI credentials in n8n Cloud.
n8n version: 2.19.3
Credential: OpenAI account
Base URL: https://api.openai.com/v1
Organization ID: empty
Custom headers: disabled
OpenAI billing: active
API key: newly created, with All permissions, inside the correct project
When I try to save/test the credential, n8n shows:
config.headers.setContentType is not a function
This does not seem to be an OpenAI API key or billing issue, because the error happens inside n8n before the request is completed.
I found a similar report mentioning that requests to api.openai.com may fail in n8n 2.19.x because config.headers is being rewritten as a plain object, and then setContentType is not available.
Is there any workaround for n8n Cloud users, or does my instance need to be updated/fixed by n8n support?
Thanks!

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:

Sounds similar to this thread

same here.im stock with this,trying to debug this for about 4 hours and still same result

Temporary solution, if you don’t need to the latest features, you can downgrade to 2.18.5, still works here

The same problem with n8n running via localhost n8n = 2.19.4

If your intention is to create an AI chatbot, you may want to try this workaround that I’ve described in this thread.

welcome to the n8n community @Vinicius_Adam_Moraes

its a know issue
Since you are on n8n Cloud, I would open a support ticket and include your workspace URL, n8n version, the exact error, and the GitHub issue reference n8n-io/n8n#29471. I would not rotate the key again unless support asks for it.