Hey guys, I can’t connect my OpenAI credential on my n8n platform, but before it was working well. Why ? I created a new account yesterday and the problem happened like this.
The error config.headers.setContentType is not a function is a known bug that appeared in some n8n versions around 2.18-2.19. It’s not related to your API key or OpenAI account - it’s a compatibility issue with how the credential test request is built internally.
A few things you can try:
Update to the latest n8n version (this was patched in a later release)
If you’re self-hosting, try running npm update n8n or pull the latest Docker image
As a temporary workaround, skip the credential test and just use the credential directly in an OpenAI node with a test run - if the API key is valid, the node itself will work even if the credential tester throws this error
Could you share which n8n version you’re running? That would help narrow it down.
I’ve gotten the same error and have spent some time troubleshooting it before coming to the forum for help, and this post just pops out right in front Here’s my environment info:
Debug info
core
n8nVersion: 2.19.2
platform: docker (self-hosted)
nodeJsVersion: 24.14.1
nodeEnv: production
database: sqlite
executionMode: regular
concurrency: -1
license: enterprise (production)
consumerId: XX
storage
success: all
error: all
progress: false
manual: true
binaryMode: filesystem
pruning
enabled: true
maxAge: 336 hours
maxCount: 10000 executions
client
userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/147.0.0.0 safari/537.36
Thanks for sharing your debug info, our setups look very similar!
Here’s mine:
n8n version: 2.19.3
Platform: Docker (self-hosted on Hostinger)
Database: SQLite
Mode: production
Just like you, I’ve been stuck on this bug. I tried updating via terminal (docker compose pull + restart) and even contacted Hostinger’s support assistant, but n8n still stays on 2.19.3.
Did you find any workaround on your end? Did forcing a specific version in docker-compose.yml work for you?
As suggested by Nguyen, I triggered my workflow despite the credential test error and it works fine (with a valid API key). Most likely a bug where the error gives false alarm.
I have updated my n8n to the latest stable version (2.19.4) but still encounter the same issue. I guess this needs the attention from n8n support team.
Meanwhile, may I know what’re you trying to achieve? Perhaps there are some alternatives to temporarily work around the issue while waiting for n8n R&D team to fix the issue. If it’s an AI chatbot (with OpenAI LLM model), then you may try using OpenAI Chat Model node instead (as below).
thx it’s working also for me ! I have to create my entire workflow again and modify everything XD
By any chance, do u have an idea when the problem will be solved completly by n8n ?
Hey everyone — if you’re experiencing this issue, it appears to be a recent bug in the n8n OpenAI configuration.
Right now, the workaround is to bypass the built-in OpenAI node and manually connect to OpenAI using an HTTP Request node instead.
Why this works:
The issue seems to be tied to the current n8n OpenAI configuration. By sending a direct API HTTP request to OpenAI, you’re essentially creating a fresh connection that avoids the bug completely.
How to get started:
Click the “+” button in n8n
Search for “HTTP Request”
Add the HTTP Request node to your workflow
From there, use ChatGPT to guide you step-by-step through the setup process. A very easy method is:
• Complete one step
• Take a screenshot
• Send it to ChatGPT
• Ask for the next step
Repeat that process until your OpenAI API is fully connected and working.
The setup takes a little longer, but it works extremely well.
I personally tried all of the other suggested fixes people mentioned, and none of them solved the issue for me — but this method did.
Please reply and let me know if it worked for you.
OpenAI credentials can be finicky if the API key wasn’t copied correctly or if there’s an extra space at the end. I’d also make sure you have a valid billing method on your account, as that’s a common reason for hidden failures.