Closed volnyansky closed 2 years ago
I think the problem is that AWS ONLY checks that the metadata object is not undefined. (node_modules/@aws-sdk/client-s3/dist-cjs/protocols/Aws_restXml.js line:3585)
...(input.Metadata !== undefined &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Object.keys(input.Metadata).reduce((acc, suffix) => ({
...acc,
[`x-amz-meta-${suffix.toLowerCase()}`]: input.Metadata[suffix],
}), {})),
Your library passes to the metadata object the default value of NULL. So null !== undefined is true in Javascript and thus the error. A possible solution is to change the default value to undefined so your library aligns with the AWS API behaviour. (node_modules/multer-s3/index.js line: 18)
var defaultMetadata = staticValue(null)
to
var defaultMetadata = staticValue(undefined)
That sounds like a good workaround, would you be willing to submit a pull request?
Of course!
Fixed in 🚢 3.0.1 / 2022-05-31
I get crash if I don't specify metadata handler.
My config :