Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
wix backend script Execution Timeout Error

I want to obtain the submission ID from a wix form.

The code runs well in the preview dev tools, but on the live site the request is pending for about 14 seconds and then it returns an ExecutionTimeoutError error:

{
  "result": {
    "message": "Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.",
    "name": "ExecutionTimeoutError",
    "stack": "Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.",
    "code": "EXECUTION_TIMEOUT",
    "_elementoryError": true
  },
  "exception": true
}

Backend module:

import wixData from 'wix-data';
async function checkSubmission(email) {
    const minDate = new Date(new Date().getTime() - 2 * 60000);
    return wixData.query('dataset_name')
        .eq('email', email)
        .gt("_createdDate", minDate)
        .descending('_createdDate')
        .limit(1)
        .find()
        .then((results) => {
            if (results.items.length > 0) {
                return results.items[0];
            } else {
                return null;
            }
        });
}

export async function getSubmissionId(email) {
    let attempts = 0;

    const executePoll = async (resolve, reject) => {
        const result = await checkSubmission(email);
        attempts++;
        //console.log('- poll', attempts, result);

        if (result !== null) {
            return resolve(result._id);
        } else if (attempts == 10) {
            return reject(new Error('Exceeded max attempts to get submission'));
        } else {
            setTimeout(executePoll, 200, resolve, reject);
        }
    }

    return await new Promise(executePoll)
        .then(id => {return {"id": id}})
        .catch(error => {return {"id": null}});
}

Frontend:

import { getSubmissionId } from "backend/main.jsw"

export function wixForms1_wixFormSubmitted(event) {
    let email = event.fields[2].fieldValue;
    //console.log('getSubmissionId', email);
    getSubmissionId(email).then(result => console.log(result));
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There is a 14 second limit on the running of backend functions. See here.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!