Frontend timeout inconsistency

As you prob. know, a Wix Velo frontend times out after 14 secs. This is sometimes not enough. I have solved this problem and can run a backend function a lot longer. There is just one small thing that I cannot work out: when the frontend times out and I .catch the error, the error is different from time to time, which makes it a bit tricky to know what to do (not every error has to be a timeout). Made a test page with all the info. Click the button a couple of times, reload page, click again, you’ll see. Question: any idea how to solve the problem? I could test for “ExecutionTimeOut” or Empty, but it feels a bit half baked. See : https://www.laguiadeines.com/testpage3

LaGuiaDeInes
testpage3 | LaGuiaDeInes

I believe this is more a bug than something we can help with.

That being said, have you tried to use wix-realtime to solve your issue?

→ client sends a heavy request
← server trigger computation and return an acknowledgement

  • client subscribes to a result challenge and UI display a loading animation
    ← server sends the result via wix-realtime message
  • client retrieves data from message content

You still have the container lifetime as an hard limit but that gives you about 60second of work

also if you add a try-catch in your backend does it log different error as well? Maybe the source of the time out is different

PS: I tried a few times but was not able to replicate and only got the empty error message

Thanks Kentin, I’ll try to report it to Wix.
BTW, I solved the 14-sec timeout problem in a similar, but also different way. On the frontend, before making the backend call, I generate a unique id (using uuid NPM) and pass this id on to the backend with the call.
The backend does its work and, before returning any result, also writes the result (an object) to a collection with the id inside the row.

When the frontend goes into the timeout handler (a .catch with the above described problem), it queries the collection with the id every 5 secs (but this is a choice, could be different). If the result is there, it is displayed.
Works great. Low traffic site, so most times the container is not spinning already and you get the full 5 minutes plus the 1 minute grace period, same for db-token (but most actions finish anyway around 20-30 secs).

Have never worked with wix-realtime, but I will have a look.
Thanks again.

P.S. In all my testing, I only ran up once against the situation where the container was already spinning AND the backend function took more than 60 secs. Did you know that Velo then simply dies on you? No backend error, nothing, it simply stops working without notification.