tus / tus-js-client

A pure JavaScript client for the tus resumable upload protocol
https://tus.io/
MIT License
2.11k stars 316 forks source link

Infinite retry loop #723

Closed rizametovd closed 2 months ago

rizametovd commented 2 months ago

Question I am stuck in infinite requests loop with retry. Basically it works this way:

POST --> 201
PATCH --> 502
HEAD --> 200
PATCH --> 502
HEAD --> 200
PATCH --> 502
...infinite requests loop

Expected behavior: there should be only 4 requests (1 initial + 3 attempts) to upload a file.

Is there a way I can handle this?

Setup details Setup is quite basic:

  const tusUpload = async ({ id, file }: { file: File; id: string }): Promise<Library> => {
    return new Promise((resolve, reject) => {
      const upload = new tus.Upload(normalizeFilenameLength(file), {
        onBeforeRequest: (request) => handleBeforeRequest(request, id), // get auth token
        endpoint: TUS_ENDPOINT,
        retryDelays: [1000, 2000, 5000],
      });

      upload.start();
    });
  };
rizametovd commented 2 months ago

My bad, sorry. The error comes from backend. Closing issue.