Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update failing with timeout #138

Open
nikshepsvn opened this issue Sep 5, 2024 · 1 comment
Open

Update failing with timeout #138

nikshepsvn opened this issue Sep 5, 2024 · 1 comment

Comments

@nikshepsvn
Copy link

image
as seen here, I can't seem to update my data because of this, is it because the object is too big? What is going on and how can I get around this?

@Himasnhu-AT
Copy link

Himasnhu-AT commented Oct 3, 2024

@nikshepsvn
Try the solution specified in the above PR by increasing the timeout duration.

Here's a sample code from the PR to implement the timeout:

Copy code
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout); // Set the timeout here

try {
  const res = await fetch(`${instantBackendOrigin}${path}`, {
    method: method ?? "GET",
    headers: {
      ...(withAuth ? { Authorization: `Bearer ${authToken}` } : {}),
      "Content-Type": "application/json",
    },
    body: body ? JSON.stringify(body) : undefined,
    signal: controller.signal, // Passing the signal to abort the fetch if timeout is reached
  });

  clearTimeout(id); // Clear the timeout to free up resources
} catch (error) {
  // Handle errors, including the timeout abort error
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants