Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda