n8n - 💡(How to fix) Fix OpenAI credentials fail with "config.headers.setContentType is not a function"

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Describe the problem/error/question

What is the error message (if any)?

Error appears

  • error: all

Code Example

(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.)
⚠️ WARNING ⚠️ If you have sensitive data in your workflow (like API keys), please remove it before sharing.
RAW_BUFFERClick to expand / collapse
<!-- Please follow the template below. Skip the questions that are not relevant to you. -->

Describe the problem/error/question

OpenAI credentials fail to connect with:

config.headers.setContentType is not a function

The same OpenAI API key works correctly:

in direct API calls (/v1/models) in another n8n instance

This issue only occurs on this specific n8n instance.

I have already:

recreated the credential restarted the instance tested latest stable tested latest beta confirmed billing is active confirmed user permissions are correct

What is the error message (if any)?

Couldn’t connect with these settings

config.headers.setContentType is not a function

Please share your workflow/screenshots/recording

This occurs during OpenAI credential connection testing.

No workflow execution is required to reproduce.

Steps:

Create new OpenAI credential Paste valid API key Click connect/test Error appears

(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.)
⚠️ WARNING ⚠️ If you have sensitive data in your workflow (like API keys), please remove it before sharing.

Share the output returned by the last node

<!-- If you need help with data transformations, please also share your expected output. -->

N/A — failure occurs before workflow execution.

##Additional Notes The exact same API key works successfully:

in another n8n instance against the OpenAI /v1/models endpoint

This appears related to the current n8n/OpenAI integration layer rather than authentication or billing

Debug info

Comparison

Working instance:

  • n8n version: 2.17.5

Failing instance:

  • n8n version: 2.21.0

Same API key works successfully on 2.17.5.

core

  • n8nVersion: 2.21.0
  • platform: docker (cloud)
  • nodeJsVersion: 24.14.1
  • nodeEnv: production
  • database: sqlite
  • executionMode: regular
  • concurrency: 5
  • license: enterprise (sandbox)

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 168 hours
  • maxCount: 2500 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/147.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2026-05-12T14:51:10.703Z

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING