Here’s the core issue and how to fix it from the support thread you linked (topic: “HTTP Request to NewsAPI not pulling clean company name + dynamic date”): (n8n Community)
Problem Summary (from your thread)
Your HTTP Request node’s URL expression looked something like:
=https://newsapi.org/v2/everything?apiKey={{ $('Setup1').first().json.apiKey }}&q={{ $json.output.clean_company_name }}&from={{ DateTime.now().minus({ days: $('Setup1').first().json.newsAge }).toF...
…but clean_company_name wasn’t actually in the current node’s JSON because the node that creates it wasn’t in that exact execution path/branch. n8n drops values that aren’t in the active branch, so the expression became undefined — which breaks the URL you’re trying to send. (n8n Community)
Fix: Ensure the Data is in the HTTP Request Node
1. Bring the node that generates clean_company_name into the same path as the HTTP Request
In n8n, expressions like {{ $json.field }} only work if the node is directly before your HTTP Request node in the same branch. If you’re branching (IF / SplitInBatches / multiple paths), n8n forgets fields that aren’t on that exact path.
Solution:
Connect the node that produces clean_company_name (e.g., your Edit Fields / Set / Function node) directly to the HTTP Request, or
Use a Merge node to combine branches so the value is available where you need it.
Example flow:
Trigger → Fetch Data → Clean Company Name → HTTP Request → …
This ensures the HTTP Request node has access to clean_company_name in its input item JSON.
2. Use toISO() for dynamic date strings
Your expression for the date portion must return a proper ISO date string. If you want today minus X days:
={{ DateTime.now().minus({ days: $('Setup1').first().json.newsAge }).toISO() }}
.toISO() returns a correctly formatted date string (e.g., 2026-01-01T00:00:00.000Z) that works in query params. (n8n Docs)
3. Clean up your URL parameter layout
Instead of writing your full URL as a single long expression, split it into query parameters in the HTTP Request node — this avoids concatenation mistakes and makes debugging easier.
Example HTTP Request settings:
- Method: GET
- URL:
https://newsapi.org/v2/everything
- Query Parameters:
apiKey: ={{ $('Setup1').first().json.apiKey }}
q: ={{ $json.output.clean_company_name }}
from: ={{ DateTime.now().minus({ days: $('Setup1').first().json.newsAge }).toISO() }}
This method prevents malformed URLs because n8n builds the query string for you.
Why It Was Undefined
n8n doesn’t carry all fields across workflow branches — only the ones flowing through that specific path. If clean_company_name is calculated in a node that isn’t upstream of the HTTP Request node you’re trying to use, then $json.output.clean_company_name evaluates to undefined. (n8n Community)
Quick Checklist Before You Test Again
Confirm the node that outputs clean_company_name goes into the HTTP Request node
Use toISO() for formatting dates correctly
Prefer HTTP Request Query Parameters instead of long URL concatenation
Test the value of each expression by clicking Preview in the expression editor
If you want, you can share your workflow JSON and I can rewrite your HTTP Request node properly so it works end-to-end.