Backend Module Time Out

I have a backend function that upload an image (about 2-3 MB) to Printify.

Since it takes longer than the limit of 14 seconds for frontend to backend communications all of the requests are timed out.

I have already simplified this function as much as possible:

What should I do in this situation?


I was able to resolve this issue by contacting the velo support team!

Please contact Wix support so they can increase the timeout time

Check the newest comment below!

Oh really? They can do this? Thanks, I will contact them now.

1 Like

I see other people also do like this. This should still available now

I see that some of the threads say it is not possible:

If you asked Support and they also said no, can you post the Printify API docs related to this image upload? They might offer another workaround.

@kzdoandos Did you solve this problem? If so, how? Because I do not see a solution: you need to have a backend function for wix-secrets, you cannot pass the key back to the frontend (for security reasons) to evade the 14 sec timeout (if you move everything to the frontend, you won’t have the 14 sec timeout limit), and the file is obviously to big to pass on within 14 secs from backend. Please keep us updated, it has out interest.

I have contacted them, but still no progress. This is really ridiculous. They do not account for such use cases as this at all.
I am going to reach out to them again and hopefully explain why this is so important.

I don’t see any other way than just uploading the image from frontend to some public host and then just providing the link to printful, so they can download it there. Seems like double work, but I don’t really see any other way if they don’t allow longer timeouts.

@kzdoandos I see 1 possible way out, but it’s the long way around: upload the file from frontend to wix, set a flag in a collection when uploading has finished and another one for “processed”, make a Job Scheduler or external cron job that checks every minute for rows which have uploaded ===true and processed !== true, process the file (Job Scheduler does not have the 14
secs timeout, but a 5 min container timeout) and on the frontend, check
every 30 secs or so if the file is processed, set some kind of animation and display “done” when … done.

Job Scheduler can only do a job evry 1 hour or longer on wix,

@volkaertskristof Are you sure? I believe you can if you use cron expression, but I never tried to define one for 1 minute.

@giri-zano I have an update! I don’t know what they did exactly but it works now! I have contacted the velo team multiple times and they solved the problem.

I can solve this by listing up to 20 jobs, that means 5 mins one trigger :rofl:

But this way only applies if your site don’t need too much scheduled functions

If you define 1 minute, it will not work (cannot cheat wix😞)

@kzdoandos Glad for you. On another Wix forum we are addressing this issue too and there I read the contrary. You have done your best, but I want to find out what exactly happened, it is important enough.

@giri-zano I have a rather slow internet connection at my home and when I tested it there I was getting the timeout again… And looks like it was timing out now at 30 seconds by looking at the network tab in the dev tools. So looks like they have really increased the timeout.

@kzdoandos I’m still on this one. There seems to be some confusion (on another forum) WHAT you, with the helpp of Wix, got working:

  1. your original code, doing the fetch/wix-secrets from the backend, called from the frontend
    2)your plan B (uploading it to another, non-Wix server, from the frontend).

Could you tell me which you got (more or less) working, 1 or 2?