Skip to content

fix(core): Request helper function support setting agentOptions#28756

Merged
maspio merged 6 commits intomasterfrom
request-helper-functions_httpRequest_set_agent-options
Apr 23, 2026
Merged

fix(core): Request helper function support setting agentOptions#28756
maspio merged 6 commits intomasterfrom
request-helper-functions_httpRequest_set_agent-options

Conversation

@maspio
Copy link
Copy Markdown
Contributor

@maspio maspio commented Apr 21, 2026

Summary

Allow setting agentOptions in request-helper-functions, e.g. to set mTLS certificates when developing nodes/credentials.

  • The deprecated request helper supports setting agentOptions (see here)
  • This PR adds the same functionality to the httpRequest helper.

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions)
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

@maspio maspio marked this pull request as ready for review April 21, 2026 06:35
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Bundle Report

Bundle size has no change ✅

Affected Assets, Files, and Routes:

view changes for bundle: editor-ui-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/worker-*.js -3.15MB 17.9kB -99.43%
assets/worker-*.js 3.15MB 3.17MB 17586.03% ⚠️

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Architecture diagram
sequenceDiagram
    participant Node as Node / Credential Logic
    participant Helper as Request Helper Functions
    participant Converter as convertN8nRequestToAxios
    participant Axios as Axios Client
    participant Agent as HttpsAgent (Node.js)
    participant Target as External API

    Note over Node,Target: Request Flow with Custom TLS Options

    Node->>Helper: httpRequest(options)
    Note right of Node: options may include NEW: agentOptions<br/>(e.g., CA, Cert, Key)

    Helper->>Converter: convertN8nRequestToAxios(n8nRequest)
    
    Converter->>Converter: Get host from URL
    
    rect rgb(240, 240, 240)
        Note over Converter: Configuration Logic
        Converter->>Converter: NEW: Spread n8nRequest.agentOptions into local agentOptions
        Converter->>Converter: Set servername from host
        
        opt skipSslCertificateValidation is true
            Converter->>Converter: Set rejectUnauthorized = false
        end
    end

    Converter->>Agent: NEW: Instantiate HttpsAgent(agentOptions)
    Converter-->>Helper: axiosConfig (includes httpsAgent)

    Helper->>Axios: request(axiosConfig)
    
    Axios->>Agent: Use for connection
    Agent->>Target: TLS Handshake (using custom mTLS/CA)
    Target-->>Axios: Response
    Axios-->>Helper: Response data
    Helper-->>Node: Response data
Loading

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Performance Comparison

Comparing currentlatest master14-day baseline

Idle baseline with Instance AI module loaded

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
instance-ai-heap-used-baseline 186.69 MB 186.83 MB 186.46 MB (σ 0.26) -0.1% +0.1%
instance-ai-rss-baseline 386.93 MB 343.82 MB 366.71 MB (σ 22.88) +12.5% +5.5%

Memory consumption baseline with starter plan resources

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
memory-heap-used-baseline 115.05 MB 114.56 MB 114.47 MB (σ 0.23) +0.4% +0.5% 🔴
memory-rss-baseline 224.68 MB 286.68 MB 289.59 MB (σ 40.91) -21.6% -22.4% ⚠️

docker-stats

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
docker-image-size-runners 388.00 MB 388.00 MB 392.25 MB (σ 11.11) +0.0% -1.1%
docker-image-size-n8n 1269.76 MB 1269.76 MB 1273.60 MB (σ 10.49) +0.0% -0.3%
How to read this table
  • Current: This PR's value (or latest master if PR perf tests haven't run)
  • Latest Master: Most recent nightly master measurement
  • Baseline: Rolling 14-day average from master
  • vs Master: PR impact (current vs latest master)
  • vs Baseline: Drift from baseline (current vs rolling avg)
  • Status: ✅ within 1σ | ⚠️ 1-2σ | 🔴 >2σ regression

@n8n-assistant n8n-assistant Bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Apr 21, 2026
@ShireenMissi ShireenMissi requested review from a team, ShireenMissi, alexander-gekov and elsmr and removed request for a team, ShireenMissi and alexander-gekov April 21, 2026 08:55
elsmr
elsmr previously approved these changes Apr 22, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 22, 2026

Merging this PR will not alter performance

✅ 32 untouched benchmarks
⏩ 20 skipped benchmarks1


Comparing request-helper-functions_httpRequest_set_agent-options (b915f67) with master (d58e67e)

Open in CodSpeed

Footnotes

  1. 20 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@maspio maspio enabled auto-merge April 22, 2026 19:43
maspio and others added 2 commits April 22, 2026 21:43
changed agentOptions?: AgentOptions to agentOptions?: Omit<AgentOptions, 'socket'> in interfaces.ts:518.

The socket?: Duplex property on Node.js's AgentOptions caused the chain failure: Duplex.errored → Error | null → Error.cause: unknown → _DeepPartial<unknown> which TypeScript can't resolve in Pinia's store. Since socket is not a serializable config property and is never set via IHttpRequestOptions, omitting it from the interface type is the correct fix. The behavior at runtime is unchanged because the actual spread in request-helper-functions.ts:544 never involves a socket.
@maspio maspio added this pull request to the merge queue Apr 23, 2026
Merged via the queue into master with commit 4ce186a Apr 23, 2026
56 checks passed
@maspio maspio deleted the request-helper-functions_httpRequest_set_agent-options branch April 23, 2026 06:23
@n8n-assistant n8n-assistant Bot mentioned this pull request Apr 28, 2026
@n8n-assistant
Copy link
Copy Markdown
Contributor

n8n-assistant Bot commented Apr 28, 2026

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants