Describe the problem/error/question
Workflow keeps getting stuck at IF node
This is a paginated HTTP request, run 4 out of 10 times and stuck
I am setting a variable “page” to 1 at the beginning and incrementing 1 while “page” does not equal “page_total” (returns from http request)
What is the error message (if any)?
no error, it simply won’t advance
Am I missing anything about this node??
Please share your workflow
Any help or insights will be greatly appreciated!!
Information on your n8n setup
- n8n version: current
- Database (default: SQLite): Default
- n8n EXECUTIONS_PROCESS setting (default: own, main): Default
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Ubuntu 24.04 LTS
Hey @lcparreira , your aproach does not utiulize the “pagination” feature of HTTP Request node. More over, your implemented logic of pagination does not make much sense to me, specifically the string condition {{ $('Página Atual').item.json.page }} == {{ $('Consulta Produtos').item.json.products.last_page }}
. The page
on the left side is always equal 1 and the last_page
on the right most likely some string value.
As for the stuck If, it is likely a UI glitch. I suspect your workflow gets into endless loop.
Hello @ihortom! Thank you for taking your time on this matter.
In fact it is working fine for the first 4 iterations.
The condition {{ $('Página Atual').item.json.page }} == {{ $('Consulta Produtos').item.json.products.last_page }}
is comparing the current page
(that is incrementing at end of each run when condition fails) to the last_page
(info that comes in the http request and tells the last page of request). It should increment page
and loop while page < last_page
, and halt when page == last_page
Does it make sense?
Hey @lcparreira , if last_page
value ever becomes 1
then yes. By the gist of it, I assumed the last_page
is some sort of URL rather than the number. That is why I suggested that the If condition never fulfills.
@ihortom I see… my bad… I should have posted the request output
This is what I get from this call…
For the first four pages, it works like a charm…
then it stucks at IF node…
I would suggest to look into the data returned by Atualiza DB node during the iteration that is held. Looks like there is something in there which might cause IF node to stall.
Could it be that when the execution stops at the ‘if’ node, it has output on the true branch but not on the false branch? In that case, n8n would naturally stop executing because there are no more nodes left.
If that’s the case, you need to connect the true branch back to the beginning of your loop too.