App only works properly when ?debug_mode=true appended to URL

I know that its frustrating that debug_mode affects the behaviour of the app and its not a purely inspectional tool. In theory this is something that seems like a no-brainer; debug mode should not affect the functioning of the app. However adding debugging functionality to a page without affecting the rest of the page is not an easy feat for one main reason: it will slow down the app.
And this is probably what is going on here.
Your production app is encountering race conditions. Bubble workflows are asynchronous, they don’t necessarily trigger in order and there is absolutely no guarantee that they complete in order.
Debug mode is probably slowing down the app just enough so race conditions don’t cause problems.

Using custom worflows can be very helpful here, as custom workflows guarantee that all steps before it are completed, and all steps in the custom workflow are completed before the rest of the workflow runs.
Use ‘add a pause’ action to test whether its race conditions causing problems.

1 Like