Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda