NuxtN
Nuxt9mo ago
5 replies
sniperfull.

random no response errors on usefetch.

hello i have people reporting some issues with problems submitting a form in my project (using useFetch but named differently). the error that happens in the try catch is <no response> Failed to fetch but the connection is OK and server is online. as the error logging also goes in a usefetch post and arrives to the backend fine? when people open a new window in their browser the issue is no longer there. so its very random. how could i diagnose this as i cannot reproduce it on my system? it also is not as descriptive as i would like making diagnosing the issue way harder. anyone with any advice on fixing such issues?

it happens on the following post request:

  
    await useApiFetch("/sanctum/csrf-cookie");
    const response = await useApiFetch("/api/competition/signup", {
      method: "POST",
      body: formData,
      headers: {
        Accept: "application/json",
      },
    });

    if (response.error.value) {
      throw new Error("Failed to submit competition, error: " + response.error.value);
    }


i have also disabled csrf checking for now to diagnose. but issue still appears..
Was this page helpful?