tus-node-server icon indicating copy to clipboard operation
tus-node-server copied to clipboard

Failing S3 Uploads: Invalid Part Numbers

Open matthewcaminiti opened this issue 4 months ago • 2 comments

Initial checklist

  • [X] I understand this is a bug report and questions should be posted in the Community Forum
  • [X] I searched issues and couldn’t find anything (or linked relevant results below)

Steps to reproduce

Packages

// client
    "tus-js-client": "^4.0.1",
// server
    "@tus/server": "^1.4.1", // resolved to 1.8.0
    "@tus/s3-store": "^1.4.1", // resolved to 1.6.0

Client snippet

        tusUpload = new tus.Upload(file, {
          endpoint: `/admin/uploads/tus`, // removed url origin from snippet
          chunkSize: 6 * 1024 * 1024,
          retryDelays: [0, 1000, 3000, 5000],
          parallelUploads: 1,
          removeFingerprintOnSuccess: true,
          storeFingerprintForResuming: true,
          uploadDataDuringCreation: true,
          headers: {
            authorization: `Bearer ${token}`,
          },
          metadata: {
            name,
            id,
          },
          onProgress: function (bytesUploaded, bytesTotal) {
          },
          onSuccess: async function () {
          },
          onError: function (error) {
          },
        });

Server snippet

    const s3Store = new S3Store({
      partSize: 6 * 1024 * 1024,
      s3ClientConfig: {
        bucket: BUCKETS.UPLOADS,
        region: REGION,
      },
    });

    this.tusServer = new Server({
      path: '/admin/uploads/tus',
      datastore: s3Store,
      relativeLocation: true,
      namingFunction(req, metadata) {
        return metadata.name;
      },
      onResponseError: (req, res, err) => {
        // err
      },
    });

Expected behavior

Expectation is file upload success. Up until recently (although unknown how long this has been broken) our setup has worked without issue. With our setup we were successfully uploading and tracking the progress of uploads.

Pinning our versions of @tus/server and @tus/s3-store to 1.4.1 restores the expected behaviour.

Actual behavior

Error that is consistently hit, at seemingly the end of the upload process (server side), failing to complete the upload.

InvalidPartOrder: The list of parts was not in ascending order or did not have consecutive part numbers. The parts list must be specified order by part number, and must not have any gaps.

Stack trace comes out of the aws-sdk.

matthewcaminiti avatar Oct 21 '24 22:10 matthewcaminiti