Looping Backend Workflow: Stopping before completing

Hey Everyone.
I’m trying to diagnose an issue with my app, where I have a backend workflow that is designed to repeat itself a certain number of times (typically about 40 times but it can vary) in order to create a series of things. - The issue I’m having is that it seems to be stopping at a certain point every time I run it, and not completing the full number of cycles.

My question is:
Does bubble limit the number of times a workflow can repeat? If yes, are there any strategies to ensure that my workflow completes all of the required items and doesn’t stop until its designed to.

Thanks in advance for your thoughts!

Did you check your app capacity? Can you share your conditionnals for the loop?

Also check if somehow you get an error in one of the workflows, that could kill the whole loop (any API calls being done in the loop?)

1 Like

Good idea. So this is what’s happening (see image below). What does that ultimately mean? And any suggestions how I go about fixing this? THANK YOU!


@tylerboodman @Jici

Maxed out capacity, either schedule them further apart, or if your Workload Usage allows for it switch to the new plan/pricing structure where there is no capacity but a certain amount of usage per month is allowed before overage charges (we have like 16 months to switch no matter what)

1 Like

Yeah I’m trying to avoid switching to the new plans because the whole WU thing is going to literally bankrupt us. Just this one sequence is over 1000 WU credits. - Crap, so I’m kinda screwed? I guess I need to rework this entire flow to use less capacity??

I mean if you have to get by for now see if you can schedule them more apart? Capacity is like a speed limit so you will have to run the whole thing over a longer period of time. But either way you would need to figure it out eventually since we all have to leave capacity in a year…

1000 WUs for one loop? Or 1000 WUs for the whole thing? I guess find what’s using up so much?

Could it be that the problem is that the backend is trying to run it many times at the same time?

Have you tried putting it in the last step of the workflow, when it calls itself again, you include a delay of 5-10 seconds (current date + 5s)?

Yes that would help with capacity

But WUs will stay the same regardless of how fast they are scheduled :frowning_face: (A problem for the future)

That is true. The WU issue will be part of our daily lives from now on.

1 Like

Thank you all. - Yeah, I guess thats my only option for now. I’ll try @tylerboodman & @icaroalmeida idea with the 5 second day.

As for WU’s - 1000 WU is for the whole loop of creating 40 things, it’s actually probably closer to 1400 WU once I factor in the API calls.

But yeah, I honestly have no idea what I’ll do next October when they shut off the legacy plans. Most likely it’ll be the end of my company, we don’t have the resources to rebuild the whole thing on another platform. And we’ll be out of money in a matter of months with that type of WU burn. So yeah, feeling pretty betrayed by Bubble. Maybe @emmanuel will come up with some other way to look at their pricing by then but I’m not holding my breath.

If you’re doing the standard Create a thing action a ton, abandon that and use the Data API instead it is much more efficient

Pardon my ignorance, but can you elaborate on what you mean/how to do that?

Sure it’s the Data API built into your Bubble app, more specifically the Bulk Create endpoint you would want to use. Think of it like a uber-efficient Create a list of things action. Data API requests - Bubble Docs

You make basically make the POST request to your own app using the API connector. There should be a few tutorials here on the forum with the setup but the Bubble docs are pretty good now.

The body of the POST request you will make by taking your list of objects (from an API call?) and turning them into JSON objects using the :formatted as text operator

If you made 40 things with it it probably wouldn’t even register on the capacity graph

Would he then use a database and an external backend and use the API Connector to make these calls and make the bubble just a frontend?

@tylerboodman - Thank you for this. I will read up on this and see what I need to do. Thank you!

1 Like

It’s an endpoint for your own Bubble app, so Bubble essentially tells Bubble to make multiple things at once (they really need a Create a list of things action…)

1 Like

Hey Tyler, do you mind expanding on how you specifically bulk create items? I’m easily able to setup the data API to create 1 thing but how do you bulk create 100 items? Couldn’t find anything in the forum for this specific thing and I think it could help a lot of people. Thanks!

1 Like

I figured it out for anyone wondering. Bubble has a specific endpoint for Bulk creation.

You do need to pass in a JSON string using the :formatted as text operator like @tylerboodman mentioned.

@jacobgershkovich has a great video walking you through the bulk creation process.

1 Like

Also not sure if the video mentions it but I recommend you do the JSON safe operator after each text field

{“field1”:This thing's field1:formatted as JSON safe,“field2”:This thing's field2:formatted as JSON safe}

That will include the quotes on each side so don’t put those, it will automatically encode/replace characters that break JSON formatting like line breaks, quotes, etc.

Let us know if you see drops in WU usage :grinning_face_with_smiling_eyes:

1 Like