Unknown error inserting to collection after 1 minute.

Hi. After 1 minute or so of a long running backend process I get an unknown error when inserting items into my Photos collection. I’m inserting 50 image urls at a time, as the responses are received from a cloud server. All goes fine until about a minute in when all new requests to insert throw the error: WD_UNKNOWN_ERROR. Detail from site monitoring logs are attached below. How do I continue inserting to a collection after 1 minute in the backend? I have tried inserting 1 object at a time in a loop and also bulk insert for all images at once or in batches of 50. All throw the error after about 1 minute. Can someone help please? Thanks.

“root”: { “insertId”:“c556fc07-91f8-4c34-9bce-668a6c638d7b”“timestamp”:“2019-10-03T16:50:02.622Z”“labels”: { “siteUrl”:“https://www.seansyourguy.com/”“revision”:“3036"“namespace”:“Corvid”“tenantId”:“534a1895-cc3a-487b-8c0a-bbd892615997"“viewMode”:“Site” } “sourceLocation”: { “file”:“backend/updateMls.jsw”“line”:160"column”:34 } “operation”: { “id”:“1570121338.75644808777512581"“producer”:“backend” } “jsonPayload”: { “message”:”[{“code”:“WD_UNKNOWN_ERROR”}]” } “receiveTimestamp”:“2019-10-03T16:50:02.624Z”

Have a read of this post and view Quentin’s reply too.
https://www.wix.com/corvid/forum/community-discussion/backend-function-call-timeout

It will need the Wix Mods here to pass this onto the relevant department for them to look into further and more thoroughly.
@yisrael-wix

Otherwise, paste up your Wix Editor URL and a Wix Mod will be able to check your Editor for you and see if they can spot any issues with it themselves.
.
Please note that only Wix Admin/Mods have the specific permissions to access any Wix Editor URL that is posted in here.

I have tried writing a retry mechanism to insert to the collection when failure occurs. However no amount of retries are successful. Once the error occurs, no more inserting to the collection is possible.

Attaching logs from site monitoring below showing failure to insert to collection after exactly 1 minute. For this attempt I tried in batches of 10. For clarity what’s happening here is I download a batch of photos from mls, then upload them to a cloud server and get back the image url. Then I attempt to save that batch of image urls in my collection. Failure always occurs at 1 minute regardless of batch size. As mentioned above, I have tried writing a retry mechanism to insert to the collection when failure occurs. However no amount of retries are successful. Once the error occurs, no more inserting to the collection is possible. This is driving me crazy. Can someone at wix please help. Thanks.

10/11/2019, 12:23:11.382 PM[{“code”:“WD_UNKNOWN_ERROR”}]INFO
10/11/2019, 12:23:09.801 PM[“Process complete. Total photos saved so far: 140”]INFO
10/11/2019, 12:23:09.365 PM[“Process complete. Total photos saved so far: 130”]INFO
10/11/2019, 12:23:06.900 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:23:01.813 PM[“Running new process”]INFO
10/11/2019, 12:23:01.812 PM[“Running new process”]INFO
10/11/2019, 12:23:01.811 PM[“Running new process”]INFO
10/11/2019, 12:23:01.811 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:58.385 PM[“Process complete. Total photos saved so far: 120”]INFO
10/11/2019, 12:22:57.699 PM[“Process complete. Total photos saved so far: 110”]INFO
10/11/2019, 12:22:57.685 PM[“Process complete. Total photos saved so far: 100”]INFO
10/11/2019, 12:22:56.849 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:51.899 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:46.784 PM[“Running new process”]INFO
10/11/2019, 12:22:46.782 PM[“Running new process”]INFO
10/11/2019, 12:22:46.782 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:46.782 PM[“Running new process”]INFO
10/11/2019, 12:22:45.932 PM[“Process complete. Total photos saved so far: 90”]INFO
10/11/2019, 12:22:45.029 PM[“Process complete. Total photos saved so far: 80”]INFO
10/11/2019, 12:22:44.341 PM[“Process complete. Total photos saved so far: 70”]INFO
10/11/2019, 12:22:41.903 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:36.846 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:36.846 PM[“Running new process”]INFO
10/11/2019, 12:22:33.123 PM[“Process complete. Total photos saved so far: 60”]INFO
10/11/2019, 12:22:31.796 PM[“Running new process”]INFO
10/11/2019, 12:22:31.790 PM[“Running new process”]INFO
10/11/2019, 12:22:31.788 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:31.673 PM[“Process complete. Total photos saved so far: 50”]INFO
10/11/2019, 12:22:30.779 PM[“Process complete. Total photos saved so far: 40”]INFO
10/11/2019, 12:22:26.735 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:21.727 PM[“Process complete. Total photos saved so far: 30”]INFO
10/11/2019, 12:22:21.724 PM[“Running new process”]INFO
10/11/2019, 12:22:21.723 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:21.723 PM[“Running new process”]INFO
10/11/2019, 12:22:21.722 PM[“Running new process”]INFO
10/11/2019, 12:22:21.472 PM[“Process complete. Total photos saved so far: 20”]INFO
10/11/2019, 12:22:21.159 PM[“Process complete. Total photos saved so far: 10”]INFO
10/11/2019, 12:22:16.745 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:11.700 PM[“Running new process”]INFO
10/11/2019, 12:22:11.700 PM[“Running new process”]INFO
10/11/2019, 12:22:11.699 PM[“Waiting 5 seconds”]INFO
10/11/2019, 12:22:11.699 PM[“Running new process”]INFO
10/11/2019, 12:22:11.578 PM[“Getting 1045 photos”]INFO

Thank you @givemeawhisky for your assistance. Very much appreciated.
Editor URL: https://editor.wix.com/html/editor/web/renderer/edit/750da7e9-bdae-42fc-a729-1d5bd6421714?metaSiteId=534a1895-cc3a-487b-8c0a-bbd892615997&editorSessionId=b8dab384-c80c-4562-baa8-f183d0bd616d

@yisrael-wix

Please contact the Wix support team so that they can review your problem and assist you accordingly.

@yisrael-wix submitted thank you.

In case anyone is interested. I have learned from Wix support that a 60 second session token is issued when working with collections. I am currently waiting for a response on a resolution or work around.

Sean, very useful info. Please keep us updated.

EDIT: trying to wrap my head around the issue. What exactly does “when working with collections” mean? Since there is no explicit “close connection”, how is it timed?

@giri-zano The response I received from Wix Support was:
“It seems that after a call to backend code is made from frontend, backend gets a security token to call the database, but the token is valid for only one minute. Hence, database will start rejecting calls.”

My script is running from the backend job scheduler daily at 10am however.

@smccfly Just a question. I you run the Wix Job scheduler (which can call backend functions), why your need to call backend functions from the frontend? I believe it was J.D.who commented a while ago he had backend fuctions running for several minutes.

@giri-zano I’m only calling backend functions from the job scheduler. Backend functions have no problem running for several minutes. However after 1 minute of execution I can no longer insert to a collection. That was just the response I received from Wix Support.

@smccfly OK, it finally happened: I´m going slightly mad. Wix first states (according to you):
“It seems that after a call to backend code is made from frontend, backend gets a security token to call the database, but the token is valid for only one minute. Hence, database will start rejecting calls.”
and then you state you don´t make calls from the frontend, just backend, but you are still running into the 1 minute problem.
I´m lost here. Do you get it?

@giri-zano I never said anything to Wix support about making calls from the front end. That’s just how they responded. I’m calling backend functions from the backend job scheduler and the 1 minute problem still occurs yes.

@smccfly Now I get it. It doesn´t have anything to do with calling from the frontend. It happens always, calling from front or back. That makes more sense. But still a problem. Good luck, following.

any resolution to this ? i am also facing the same error while running a job on wix .

No not yet. Not holding my breath for a fix. I think the feedback was submitted to a wix dev team and that will be the end of it for now. Maybe we’ll see something in a future update to wixCode.

Update: urls to all the property/listing images are included in the xml received for all property/listing data. This renders the download/upload process I was troubleshooting unnecessary as I can just save the urls in a collection.