Open jagthedrummer opened 1 month ago
Hi @jagthedrummer - thanks for reaching out, sharing feedback on our documentations and workarounds.
As we're always working on improving our docs to be more clear, concise and effective, feedback like this are crucial to our work.
As you'd probably already know, the reason behind the error is the Body Data type mismatch which was sent and rejected by S3. I haven't attempted to reproduce it with electron app but as soon as we can confirm, will update the code example accordingly.
Best, John
This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.
This is still an issue.
Also, the bot seems counterproductive and frankly kind of hostile to the idea that people should let you know about things that aren't working as expected. The message it seems to send is "we didn't bother to get around to this, so we're going to throw it in the trash".
Checkboxes for prior research
Describe the bug
This example code doesn't work:
https://github.com/aws/aws-sdk-js-v3/blob/main/lib/lib-storage/example-code/file-upload.ts
When I run that an error is thrown saying:
SDK version number
@aws-sdk/lib-storage@3.577.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.15.0
Reproduction Steps
Run this example code:
https://github.com/aws/aws-sdk-js-v3/blob/9f65b408e72b6bc715591f16488bf95c5bdeda89/lib/lib-storage/example-code/file-upload.ts#L1-L24
Observed Behavior
And error is thrown that says:
Expected Behavior
The example code should work without throwing errors.
Possible Solution
After much searching and piecing together of various answers I found that the following two methods can be used to turn a node
ReadStream
into aReadableStream
. (In an electron app using node filesystem apis. I don't know if this would work in vanilla node.)So then instead of this:
https://github.com/aws/aws-sdk-js-v3/blob/9f65b408e72b6bc715591f16488bf95c5bdeda89/lib/lib-storage/example-code/file-upload.ts#L6
You can do this:
Additional Information/Context
I'm using this in an electron app.
A few related issues, none of which seem to contain a full working resolution:
https://github.com/aws/aws-sdk-js-v3/issues/2365
https://github.com/aws/aws-sdk-js-v3/issues/2183
https://github.com/aws/aws-sdk-js-v3/issues/2145