I have a strange issue on my app and I can’t find whats the problem :
My app allows users to upload online photo albums, with various limits of data depending on plans.
I have an endpoint that gets triggered when a customer’s subscription comes to its end. When this endpoint is triggered, it makes various changes in database + checks if the current amount of data uploaded by my customer is above the maximum allowed on his new plan (free or downgraded). If it is the case. Its changes the field “exceeding data” to yes for this customer.
Then, I schedule an API workflow backend, that triggers only when this field is on yes. This API worflow deletes the oldest album from my user, then reruns the calculations for the amount of data online. If the data is now below the maximum allowed, the “exceeding data” comes back to no. If not, it is supposed to reschedule this exact same API worflow and run it again.
Thats where my problem is : The API worflow does not run again. It runs the first time and then nothing happens. I checked my database and “exceeding data” is still on “yes” si it should be triggered as you can see here.
It shows that the API worflow did not get scheduled again because condition was not meant. Which is weird as condition is “user’s data exceed is yes” and when i check data, is actually is yes.
I have to check that but I doubt it could be this as the worflow runs well the first time, with the exact same conditions. It then fails to run when the scheduled API worflow has to “Re schedule” itself (or a second similar one as i just tried).
Also I just tried the exact same worflow but without the condition on the API worflow being scheduled, and it worked fine. The issue comes from the condition, but it is essential to this worflow as i need to delete only the right amount of data from my users.
Last time this happened to me, it was the order of operations funk.. It appears Step 4’s conditional is requiring Step 3 to be completed and updated.. The issue could be it’s not updating that value quick enough and the condition is failing.
It’s happened to me more times than I can count in Bubble - And unfortunately I’ve almost always had to find other ways to run workflows to ensure that values are being set at the right time to ensure conditionals are grabbing the latest values.
That’s where my money is here. I don’t envy the debugging process. If it’s possible, try to use “Only when Step 3 isn’t empty AND utilisateur’s Data depassee is yes.”
Hope you figure it out! 50/50 on whether the above will work. But worth a shot.
Ok so I followed your advice and made sure it hade time to complete step 3 + added a step in the middle
But here I have some very strange issue :
BEFORE this API worflow starts, the value of '“data depassée” has to be set on YES, otherwise it does not run.
So the default value of this is YES
Then the worflow runs, and STEP 3 is then this way :
CONDITION TO BE RUN : If users’ Albums published : each item data : sum < users’ account level data allowed
Then : Make changes to user : Data depassée : NO
Then Step 5 :
Re schedule API worflow only when Data depassée is YES (wich was default value) based on result of step 3
Whith this structure, my logs tell me that “condition is not met”. Then I tried running it only when Data depassée is NO (ignoring step 3). And now, it runs :’)
I can’t explain why, as default value was then YES, and logs clearly tell that step 3 did not run because conditions were not met.
I just ran the whole loop with the condition set to NO, and it deleted all albums one by one, so the loop system works, it just seems to ignore the value of the value of this “data depassée” field and consider it always “no” despite it clearly being YES.
And here logs always tell me that condition is not met. When I changed condition to “NO”, it ran and seemed to be always met (even when it was not the case in my database).
Also note that there is only one user on my test app, so it can’t come from the fact that the wrong user is passed. Also, albums linked to user are being recognized, so it tells that we are focused on the right user.