Open Kam205 opened 6 months ago
This is likely not a bug in tus-js-client but a configuration problem where the endpoint
that you have defined is not a tus upload creation URL. Hence the response from the endpoint does not include the Location header as is expected from tus-js-client. You should double check the endpoint URL and have a look at Supabase's documentation. I haven't used their services and don't know their API.
Describe the bug Whenever I try upload a file I am getting "tus: invalid or missing Location header, originated from request".
Failed because: tus: invalid or missing Location header, originated from request (method: POST, url: http://localhost:54321/storage/v1/object/filesupload/Gomathi Professional Development (1) (1).pdf, response code: 200, response text: {"Id":"88ea47f7-2522-4980-a259-f8072e4da259","Key":"filesupload/Gomathi Professional Development (1) (1).pdf"}, request id: n/a)
To Reproduce const upload = new tus.Upload(fileStream, { endpoint:
${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/filesupload/${file.name}
, retryDelays: [0, 3000, 5000, 10000, 20000], headers: { authorization:Bearer ${accessToken[1]}
, 'x-upsert': 'true', // optionally set upsert to true to overwrite existing files "Content-Location" :${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/filesupload/${file.name}
, location: uploadURl, }, uploadDataDuringCreation: true, uploadSize: fileBuffer.length, removeFingerprintOnSuccess: true, // Important if you want to allow re-uploading the same file https://github.com/tus/tus-js-client/blob/main/docs/api.md#removefingerprintonsuccess metadata: { bucketName: BUCKET_NAME, objectName: file.name, contentType: 'image/png',Please try to reproduce the problem when uploading to our public tus instance at https://tusd.tusdemo.net/files/, if applicable to your situation. This helps us to determine whether the problem may be caused by the server component.
Expected behavior File should uploaded.