Code Monkey home page Code Monkey logo

Comments (10)

rougsig avatar rougsig commented on June 3, 2024 2

Nothing will break if I don't use extensions for expiration and do this patch?

diff --git a/dist/index.js b/dist/index.js
index cd35efbf3298386fa77a75bae10f43ac92e8b4c8..8e72d9e1369fdac7d3616824a1ee1a816f9296d9 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -106,7 +106,6 @@ class S3Store extends server_1.DataStore {
             Bucket: this.bucket,
             Key: this.infoKey(upload.id),
             Body: JSON.stringify(upload),
-            Tagging: `Tus-Completed=false`,
             Metadata: {
                 'upload-id': uploadId,
                 'tus-version': server_2.TUS_RESUMABLE,
@@ -120,7 +119,6 @@ class S3Store extends server_1.DataStore {
             Bucket: this.bucket,
             Key: this.infoKey(upload.id),
             Body: JSON.stringify(upload),
-            Tagging: `Tus-Completed=true`,
             Metadata: {
                 'upload-id': uploadId,
                 'tus-version': server_2.TUS_RESUMABLE,
@@ -184,7 +182,6 @@ class S3Store extends server_1.DataStore {
             Bucket: this.bucket,
             Key: this.partKey(id, true),
             Body: readStream,
-            Tagging: 'Tus-Completed=false',
         });
         log(`[${id}] finished uploading incomplete part`);
         return data.ETag;

from tus-node-server.

fenos avatar fenos commented on June 3, 2024 1

@rougsig no, nothing will break, since tagging is only a useful feature for cleaning up assets using lifecycle rules

Will raise a PR sometime soon to address this

from tus-node-server.

fenos avatar fenos commented on June 3, 2024

can you try using the onResponseError function on the Server to inspect the error you are getting, that might help know the cause of this error

const tusServer = new Server({
  path: "/files",
  datastore: s3Store,
  onResponseError: (req, res, err) => {
      console.error(err)
  }
});

from tus-node-server.

adrianocr avatar adrianocr commented on June 3, 2024

This is the error log:

onResponseError
InvalidArgument: Unsupported header 'x-amz-tagging' received for this API call.
at throwDefaultError (/app/node_modules/@smithy/smithy-client/dist-cjs/default-error-handler.js:8:22)
at /app/node_modules/@smithy/smithy-client/dist-cjs/default-error-handler.js:18:39
at de_PutObjectCommandError (/app/node_modules/@aws-sdk/client-s3/dist-cjs/protocols/Aws_restXml.js:4841:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /app/node_modules/@smithy/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
at async /app/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:30:20
at async /app/node_modules/@smithy/middleware-retry/dist-cjs/retryMiddleware.js:31:46
at async /app/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/flexibleChecksumsMiddleware.js:63:20
at async /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-endpoint-middleware.js:14:24
at async /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-middleware.js:9:20 {
'$fault': 'client',
'$metadata': {
httpStatusCode: 400,
requestId: '1289c689d96015bc',
extendedRequestId: 'adcNu/WuvbnZvUHdPbpw=',
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
Code: 'InvalidArgument'
}

I did a little googling and it seems that backblaze b2 (which is my storage provider) has issues with the x-amz-tagging header: https://www.backblaze.com/docs/cloud-storage-s3-compatible-api#get-object-tagging

Any way to remove that header from the COPY and PUT object calls?

from tus-node-server.

fenos avatar fenos commented on June 3, 2024

mmmh, I see - it seems that this issue is caused by the expiration extension which uses tags.
I'm wondering if we should disable tagging if the expiration extension is not used

https://github.com/tus/tus-node-server/blob/main/packages/s3-store/index.ts#L107

We don't provide a way to turn off tagging, currently, we tested this on AWS S3 / Minio which both supports tagging hence we didn't realise that tagging is not always implemented in all stores

Probably is something we should provide an option in the s3 store

something like:

const s3Store = new S3Store({
  useTags: false, // <-- new option
  s3ClientConfig: {
    ...
  },
});

alternatively we might to do the otherway around where we have to specify a tag name for opting-in on object tags:

const s3Store = new S3Store({
  tagName: 'Tus-Completed', // <-- new option
  s3ClientConfig: {
    ...
  },
});

Thoughts @Murderlon

from tus-node-server.

adrianocr avatar adrianocr commented on June 3, 2024

In the meantime I migrated to using wasabi which just ignores the x-amz-tagging header. Out of curiosity I was also considering using DigitalOcean Spaces (S3 compatible) and they also ignore the x-amz-tagging header. So it seems only AWS S3 and perhaps a few others actually make use of that tag.

I believe your suggested approach where the tag can be disabled or opt-in would be ideal.

from tus-node-server.

fenos avatar fenos commented on June 3, 2024

if they ignore it and do not throw an error is fine, i was surprised that backblaze b2 errors out

from tus-node-server.

Murderlon avatar Murderlon commented on June 3, 2024

Indeed it's a bit odd that Backblaze throws an error. But an option to disable tags makes sense. The boolean options seems more logical for this use case 👍

from tus-node-server.

rougsig avatar rougsig commented on June 3, 2024

Wanted too.

from tus-node-server.

fenos avatar fenos commented on June 3, 2024

PR is up 👆

from tus-node-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.