HTTP request node - sending async requests (not waiting for response)

Describe the issue/error/question

I am using the HTTP response node to send request to my own python flask server to use selenium to retrieve pdf files, however it takes quite a long time for the request to complete (30 to 60 sec), on completion it will send a http file response back.

The problem i am having is that I would like to have n8n hold off the next request until the current request has completed and returned the file.

currently starting a new request while one is currently being executed will cause it to fail.

So for now to get around it I am just setting an interval of 60sec between requests and it seems to be enough for the job to complete. But this is very inefficient because it will be waiting when a request has already been completed and returned.

I would like it to send the next request after receiving a response (with the PDF)

What is the error message (if any)?


This shows the incoming requests being started concurrently instead of consecutively

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

Latest N8n
on local server as a docker container

Hi @Josh-Ghazi, does your service respond only once the operation has finished? If so, you could use the SplitInBatches node to make sure only 1 item at a time is passed on to the HTTP Request node:

Thank you for the quick response!

Thank you this might be what I am looking for, so to clarify how can I make it so that the loop is complete before it will continue on to trigger the nodes later in the workflow?

Lastly the HTTP Request node also has a batch option, but apparently it doesnt wait for a response before sending the next request? would it be difficult to add the extra functionality to wait for response??

The run index is not working???

I get 1 on both runs? when it should be 2 on the second run which will trigger the if false branch to continue to workflow??

Okay so ive done my if node wrong, i have followed the if node from this example here https://n8n.io/workflows/1160/ and it seems to work great!

Hi @Josh-Ghazi

If you have the option to add community nodes to the workflow. There is a community node for the splitinbatches node that will allow you to use it a bit easier when continuing the workflow after the loop. might be worth checking out if your current workflow is giving you issues.

1 Like

Wow! thank you for showing me the community nodes! I am interested to see the extra features.

1 Like

wow this advanced split in batches node is extremely useful!

I have implemented it in my http loop and its simplified the entire workflow by a large number of redundant nodes, the work flow is so much tidier and it saves so much time with building similar workflows!

The best part is the separated output and the combine feature which is what ive been looking for this whole time. this should definitely be a core node.

2 Likes