rpldy/react-uploady

TusUploady + supabase storage gives ChunkedSendError: start byte 84715 is invalid. File size: 84715

darthwade opened this issue · 2 comments

Hi, I'm trying to implement resumable uploads with Supabase Storage & react-uploady.

With such configuration:

 <TusUploady
      destination={{
        url: `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/upload/resumable`,
        headers: {
          authorization: `Bearer ${session?.access_token}`,
          apikey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
          'x-upsert': 'true', // optionally set upsert to true to overwrite existing files
        },
        params: {
          bucketName: bucketName,
          objectName: fileName,
          contentType: 'application/pdf',
          cacheControl: 3600,
        },
      }}
      // NOTE: it must be set to 6MB (for now) do not change it
      chunkSize={6 * 1024 * 1024}
      sendDataOnCreate
      forgetOnSuccess
    >
      <UploadButton />
    </TusUploady>

I receive next errors:

HEAD https://wyouutsakkdyazecsojs.supabase.co/storage/v1/upload/resumable/dGVzdC90ZXN0L3Rlc3QyLnBkZi80YmZjZmY1MC1kYTcxLTQxNDMtYWE1Ni0yMTMxM2NmYWFmOGY 400 (Bad Request)

getChunks.js:10 Uncaught (in promise) ChunkedSendError: start byte 84715 is invalid. File size: 84715
    at getChunks (getChunks.js:10:11)
    at processChunks (processChunks.js:46:72)
    at Object.send (createChunkedSender.js:20:76)
    at doChunkedUploadForItem (handleTusUpload.js:28:39)
    at eval (handleTusUpload.js:64:17)
image

File uploaded successfully though
image

Versions

    "@rpldy/tus-uploady": "1.8.0",
    "@rpldy/upload-button": "1.8.0",
    "@rpldy/upload-preview": "1.8.0",
    "@rpldy/uploady": "1.8.0",

I would be grateful for any help, thanks for the dope library!

Hey @darthwade
What I understand is that the Supabase server is responding with an error on the initial HEAD request? Which is part of the Tus protocol chunk handshake.
I wouldn't expect then that the upload will succeed, it's very strange to be honest.

Since it is successful, I think this is something to check on the Supabase end. Not sure what can be done on the Uploady side

Got it, thanks, I'll do further investigation