I have a custom API endpoint that takes 2-5 minutes to complete (processes CT scans through an ML model). Unfortunately, Bubble times out before the request is complete. I’ve read on other forum threads that Bubble times out after 60 seconds.
Is there any way to solve this timeout issue?
Ideally, I’d be able to change the timeout settings to > 5 minutes but if that’s not possible is there another workaround? Leveraging backend workflows? Using Webhooks? Adding custom javascript or creating a plugin?
Out of curiosity, why would moving the function to a different cloud help? Wouldn’t I still be dealing with the same timeout problem regardless of the hosting service?
The idea is to call an external async faas and have it send the response back via a backend workflow or the data api
Fire the trigger
The trigger returns a “work started” response
When the functions done, it sends the response to a backend workflow for further processing.
There is no API timeout work around. The correct solution is to give back the indication that the job has started and then run the job on a thread on the back end server. If you want to be sure that the user waits for the end of the task, you should return with the “submitted work” response a progress id of some kind. That progress id will be the handle that the task, once finished, will send data to and trigger the closing process.
This progress can be done within bubble with a “Thing” called progress, where you submit the new ID to the call along the data. Once finished the job, it uses a workflow api to notify that the task has finished.
The progress id can also be created at the backend and delivered back on the response. This will make it harder on the bubble side as it will have to pull data every few seconds from the backend server. The good thing is that will be bubble.io agnostic and you will be able to use this progress api on other components or clients. This “visual” pulling on the interface can be avoided with a costum element module.
I’ve done everything that I’ve described on one of my projects, so I know it works and what are the caveats. Get in touch if you need some assistance on these.