Hey everyone,
I’m working on an n8n workflow that pulls URLs from Supabase, performs web scraping, then AI classification, and finally stores the results back into the database.
So far, my setup works like this:
- The workflow is triggered manually or via a webhook.
- An HTTP Request sends the
id
to a webhook, which retrieves the corresponding URL from Supabase. - After processing, the
id
is incremented by 1, and another webhook call moves to the next row. - This continues until all URLs have been processed.
This works, but it’s not very efficient – too many unnecessary webhooks and HTTP Requests, it’s completely sequential, and it’s hard to scale with a large number of records. Also, if a URL is invalid, the workflow might get stuck.
I’m considering switching to Loop Over Items, which could make the workflow more streamlined and faster.
New approach:
- Supabase Select → Instead of fetching one
id
at a time, retrieve all unprocessed URLs at once. - Loop Over Items (batch size = 1) → Iterate directly within n8n, no need for webhooks.
- Scraping + AI Classification → Analyze the content.
- Supabase Insert → Save the results back to the database.
- If node → If a URL fails, log it and continue.
- Loop continues until all URLs are processed.
I believe this might be more efficient – fewer unnecessary requests, no need for manual ID incrementation, and better scalability. It would also handle failing URLs better by logging them instead of stopping the workflow.
My questions:
- Are there any downsides to this approach that I should be aware of?
- Is there an even better way to iterate through Supabase records in n8n?
- What’s the best way to handle scraping failures to prevent the workflow from stopping due to a few broken URLs?
Thanks in advance for any suggestions or insights!