aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.06k stars 573 forks source link

@aws-sdk/lib-storage doesn't upload and freezes program #6030

Closed Calemy closed 5 months ago

Calemy commented 5 months ago

Checkboxes for prior research

Describe the bug

I try to upload a stream.passThrough() object via the lib-storage. when i run the code it just freezes the entire code

SDK version number

@aws-sdk/package-name@version, ...

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Bun 1.1.4

Reproduction Steps

import { Upload } from "@aws-sdk/lib-storage"
import { S3 } from "@aws-sdk/client-s3"
import stream from "stream"
import fetch from "node-fetch"
const storage = new S3({
    endpoint: "https://s3.eu-central-2.wasabisys.com",
    region: "eu-central-2",
    credentials: {
        accessKeyId: process.env.storageID,
        secretAccessKey: process.env.storageKey
    }
})

const request = await fetch("https://catboy.best/d/1")
request.body.pipe(await uploadToStorage("maps/1.osz"))

async function uploadToStorage(path, retries = 0){
    const data = new stream.PassThrough()
    try {
        const upload = new Upload({
            client: storage,
            params: {
                Bucket: "mino",
                Key: path,
                Body: data
            }
        })
        upload.on("httpUploadProgress", (progress) => { console.log(progress) })
        console.log(await upload.done())
    } catch(e){
        console.error(e)
    } finally {
        return data;
    }
}

Observed Behavior

progress never starts, function never gets finished and is stuck.

Expected Behavior

to upload the file

Possible Solution

No response

Additional Information/Context

No response

RanVaknin commented 5 months ago

Hi @Calemy ,

The AWS SDK S3 client only officially guarantees compatibility with the AWS S3 service. We do not guarantee support for S3 clones like Wasabi / MinIO / digital ocean spaces or any other non AWS products.

Since this is not actionable by the SDK team I'm going to go ahead and close this.

Thanks, Ran~

github-actions[bot] commented 4 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.