-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade S3 example to use the newest SDK. #163
Comments
Okay, I fixed it like this, so you need to install import { DeleteObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { Upload } from '@aws-sdk/lib-storage';
export const uploadStream = ({ Key }: Pick<PutObjectCommandInput, 'Key'>) => {
const client = new S3Client({ region: S3_STORAGE_REGION });
const pass = new PassThrough();
return {
writeStream: pass,
promise: new Upload({
client,
params: {
Body: pass,
Bucket: S3_STORAGE_BUCKET,
Key,
},
}).done(),
};
}; Then you'll also have to grab the location, if the request was successful in const file = await stream.promise;
if ('Location' in file) {
return file.Location;
}
throw new Error('Upload to S3 aborted'); |
Made a PR to add an example for the new SDK version here: #164 |
This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed. |
This issue has been automatically closed because we didn't hear anything from the original author after the previous notice. |
Recently, the AWS SDK v3 has been released and its now the recommended way to interact with AWS.
I tried to upgrade the S3 example myself, like this:
But it doesn't work because an error is thrown:
by this line:
in
uploadStreamToS3()
.I'm not skilled in S3, so I have no idea how to fix this.
The text was updated successfully, but these errors were encountered: