Hi everyone, I’m running into an issue with expressions in an HTTP Request node. I’m trying to pass a value from a previous node into the request body, but sometimes the value ends up empty or undefined, even though I can see the correct data in the execution preview.
My workflow is basically:
Webhook → Set → HTTP Request
In the Set node, I create a field called user_id, and then in the HTTP Request node I try to send that value in the JSON body.
Here’s roughly what I’m doing:// Set node
{
“user_id”: “{{$json.id}}”,
“email”: “{{$json.email}}”
}
// HTTP Request body
{
“id”: “{{$json.user_id}}”,
“email”: “{{$json.email}}”
}
// Sometimes the request ends up like this
{
“id”: “”,
“email”: “test@email.com”
}
// I also tried referencing the node directly
{{$node[“Set”].json[“user_id”]}}
Describe the problem/error/question
The strange part is that the execution preview shows the correct value, but when the request is sent, user_id sometimes becomes empty.
I’m not sure if this is an expression scope issue or if I’m referencing the previous node incorrectly.
Has anyone experienced something similar with n8n expressions inside the HTTP Request node? I’m trying to figure out the most reliable way to pass values from one node to another.
What is the error message (if any)?
Please share your workflow
(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.)
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: