Page workflow Asynchronous actions

I have a problem, that when I run my workflow with a debugger it works correctly.
But without the debugger it doesn’t.

I just have 1 backend workflow, which doesn’t impact anything in general, but…

When I use custom event and I have a normal workflow step 1, 2 etc. and then trigger the custom event on frontend.

Is this possible that the custom event behave asynchronous? Event when it is a not a backend workflow?
Can i somehow make it wait for the previous step? As I cannot refer to the first step of the process.

I am FAR from a bubble expert and may not completely understand your problem, but…

I am pretty sure you can NOT depend on bubble executing each of your steps sequentially. If you have a custom event that does 5 things, bubble won’t necessarily do thing 1, THEN thing 2, THEN thing 3 and so on. It may start thing 1 AND then start thing 2 before it’s done with thing 1.

Using the debugger lets bubble “catch up” with its execution of a single step, so it appears to work properly. But letting it run normally can result in the scenario above.

You may want to try using “the results of step x” to put more conditions in your workflow. Or perhaps scheduling them at current time (add seconds): + 1.

Hopefully someone will chime in with a better description of what I just stumbled through.

Some actions are performed asynchronously… Which can cause your application to “break” if you have to wait for the previous step to complete. Especially if you have many actions in the same workflow.

The best alternative to force the “correct” behavior is use “Custom Events”. The main workflow will continue only after que “Custom Event” ends… So doing this you can have a better control of larges workflows…

You can.:

  1. Link a Step to another (using conditions like When “Step1 results is not empty”;
    2.Use Custom Events;
    3.Use Backend inside a WF;
    4.Use Pause (sometimes it does not work…)
    5.Use a plugin called “Wait”
    BackEnd is asynchronous as well;
    Bubble is completely asynchronous
1 Like

@augusto1 Custom events are the reason I have this problem in the first place.
As when I have steps and custom event - they both trigger at the same time.

I think it is problematic it doesn’t wait for itself or that you cannot always manually say - wait for step X. Don’t know why some steps doesn’t have this constrain on the trigger.

That is why it works in debugger step by step as it forces the order of actions.

@rpetribu So you say 2 custom workflows are synchronous, but one custom workflow and an action are not?
I think this is a thing hard to figure out.

One Custom event is triggered only after the first one is done.
Custom Events are the secure way to link an event after another.

Step1 => CEvent1=>CEvent2=>Step2

  • CEvent2 will be triggered only after CEvent1 has finished;
  • Step2 will be triggered only after CEvent2 has finished;
    This you can rely on

I may be wrong, but I am pretty sure that pausing for a certain amount of time only works for visual things, such as opening a pop-up. I don’t think it has an impact on non-visual things, such as database updates or api calls.

Solution is @augusto1 2nd point.
I packed all actions into custom workflows.

You cant link steps together - there is no if result of step 1 is xxx constrain there nor there is a functionality of pause. Backed I don’t want to use as I want the actions to be as synchronous as posible.
What makes my work a nightmare is the multiple relations (one item has many items and second item has also many items), so I am really working with custom state combos to make this work correctly.

Once bubble adds a good log of backend workflow I am going to migrate for this. Currently I only use it to iterate a list on certain elements until an element changes - as this action is not doable otherwise.
Plus - for all external triggers.

What is exatcly what I said in first place :rofl:

Your main workflow will wait until your custom event ends in order to preceed.

1 Like

Screenshot 2024-01-30 at 11.04.14 AM
^^^ This would solve this problem for good. I believe this would reduce the learning curve in Bubble. I’ve been using Bubble for years and still run into workflow execution issues - In many cases, I’d take the hit in performance to a “Please run my workflows in these steps because they rely on each other”.

(The screenshot was made by me as an example - It is not a feature in Bubble)

2 Likes