HTTP Request Node: Credentials fail in full workflow execution but succeed in manual "Execute Step"

Problem Description
n8n Version: 2.11.3 (Self Hosted)
Node Type: HTTP Request (v4.2)
Authentication Type: Predefined Credential Type (OpenAI API)

Summary:
I have detected inconsistent behavior in the HTTP Request node when it uses predefined credentials. The node fails with authentication errors (401 Unauthorized) when the workflow runs from start to finish (either via a Trigger or by clicking “Execute Workflow”), but it works perfectly if I select the same node and manually click “Execute Step”.

Steps to Reproduce:

  1. Create an HTTP Request node configured to use Predefined Credential Type (e.g., OpenAI).

  2. Test the node individually using “Execute Step”. The result is successful (200 OK).

  3. Run the full workflow that contains this node.

  4. The node fails during the full execution, returning a credentials/authentication error.

Technical Details:

  • Manual Behavior: The node appears to inject the credentials correctly when executed in isolation.

  • Workflow Behavior: It seems that the token or authentication header is not propagated or injected correctly when the node is triggered by the data flow from a previous node during a full workflow execution.

  • Workaround: If I change the configuration to Authentication: None and manually add the header Authorization: Bearer [TOKEN], the workflow works correctly in both modes (manual and automatic). This confirms that the OpenAI credentials are valid and the issue lies in the internal credential handling of the HTTP Request node.

Hi @dark_note Welcome!
Have you tried switching your Auth to Generic Credential Type → Bearer Auth and then pasting your openAI token there ?

Hi @dark_note

Try to delete the existing OpenAI credential and recreate it from scratch. This resets the permission state in the database.

Hope will fix it :crossed_fingers:

This is a known quirk of how n8n resolves credentials differently between “Execute Step” (single node test) and a full workflow run.

When you click “Execute Step” on a single node, n8n loads and decrypts the credential fresh for that isolated test. In a full workflow run, credentials get resolved at workflow initialization – and if there’s a timing issue, version mismatch, or the credential record got into a partially cached state, the decrypted value can come out wrong or empty, giving you a 401.

A few things to check:

1. Recreate the credential from scratch. Don’t edit the existing one – delete it and create a new one. There’s a known issue where editing an OpenAI credential in place can leave the database in a state where the key is not fully persisted. Create new, save, re-select it in the HTTP Request node.

2. Switch to Generic Credential Type with Bearer Token. In the HTTP Request node’s “Authentication” setting, choose “Generic Credential Type” then “Bearer Auth” and create a new credential with just your API key. This bypasses the predefined OpenAI credential type entirely and has more predictable behavior.

3. Check your n8n version. v2.11.3 has some credential caching bugs that were patched in later versions. If you’re on self-hosted, worth checking if an update is available.

4. Use $env to test. If you set your key as an environment variable (N8N_OPENAI_KEY=sk-... in your .env), you can reference {{ $env.N8N_OPENAI_KEY }} directly in a Code node to verify the value is actually making it through during full execution – this rules out credential resolution vs. actual key issues.