API Timeout Extension

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?

No workaround on that. If you wanna chat about moving your long running function to a different cloud, hmu!!.

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?

Also, I see in a different thread that you said using webhooks might help (What is the API plugin's timeout?). Is that not the case anymore?

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.

1 Like

I like your thinking! That’s a good way to do it. I’m using Cloud Run rn so I can probably do everything in that Docker image.

How exactly do I create an “endpoint” on Bubble’s side that I can trigger in my async cloud function? Can I do this with a backend workflow?

You could create a RTDB listener to wait for data dumps and use those to trigger the cloud run function.

Have the function return null instead of terminating in res.send()

That makes sense. And then I would just trigger a POST request to my backend workflow?

1 Like

Yeah boiiii.

You have to bring it full circle like that. Post it up to your packed to complete the task at hand

This is exactly how we manage sFTP calls from Bubble.

1 Like

Hello @jared.gibb , I have the same problem but I can’t understand the solution you talked about here. Is it possible to speak to you?

Thanks!

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.

1 Like

Also facing the same problem of the 50 secs timeout.
There’s a feature request to make this configurable:
Upvote here: https://bubble.io/ideaboard?idea=1676093536853x492549163479203840

1 Like