Expression not passing to HTTP POST request

EDIT: I have found a workaround that has made this issue irrelevant however it still appears to be an issue as the expression shouldn’t be dropped. Happy to help the n8n team investigate further.

Side note, boy the mailchimp api is painful and really not well documented for first time builders!

Hey community! Having an issue today with a workflow, specifically a HTTP request node that is performing a POST command using a URL that is built from an expression. This expression ends up being dropped at the time of the request with only my additional text “/members” being sent, even though the expression field shows it has pulled in the URL from a previous node.

example

The node failing in my workflow is the HTTP request “Add user to segment”

Please share the workflow

Share the output returned by the last node

{“status”:“rejected”,“reason”:{“name”:“RequestError”,“message”:“Error: Invalid URI "/members"”,“cause”:{},“error”:{},“options”:{“timeout”:3600000,“headers”:{“Authorization”:“REDACTED-us7”,“accept”:“application/json,text/*;q=0.99”},“method”:“POST”,“uri”:“/members”,“gzip”:true,“rejectUnauthorized”:true,“body”:{“email_address”:“REDACTED”},“json”:true,“simple”:true,“resolveWithFullResponse”:false,“transform2xxOnly”:false}}}

Information on your n8n setup

  • **n8n version:0.185.0
  • Running n8n via [Docker]:

Hi @benjaminbroughton, looks like you have asked a similar question on Discord already, so copying my response for visibility here:

Having an issue today with a workflow, specifically a HTTP request node that is performing a POST command using a URL that is built from an expression. This expression ends up being dropped at the time of the request with only my additional text “/members” being sent, even though the expression field shows it has pulled in the URL from a previous node

This would happen if you have more than one item on your HTTP Request node, but only one item on your Create Segment node (which seems likely here seeing you use the Airtable node which typically returns multiple items).

So you might need to adjust your expression so it always reads the first (and only) item from your Create Segment node. You can do this using the $item(0). prefix in your expression, so something like {{ $item(0).$node["Create Segment"].json["_links"][0]["href"] }}/members. Check out the documentation on $item(0) here.

1 Like