-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Below is my test code for uploading raw text file.
Whenever I run S3.uploadFile(), I get [TypeError: Network request failed]
The S3.listFile() method is working for me
import ReactS3Client from 'react-aws-s3-typescript';
export default class S3 {
static s3Config = {
bucketName: 'xxx',
region: 'us-east-1',
accessKeyId:'xxx',
secretAccessKey: 'xxx',
}
static async uploadFile() {
let file = new File(["test"], "testFile.text", { type: 'text/plain' }); // test file
const s3 = new ReactS3Client(S3.s3Config);
try {
const res = await s3.uploadFile(file, "testFile.text");
console.log(res);
} catch (exception) {
console.log(exception);
}
}
static async listFile() {
const s3 = new ReactS3Client(S3.s3Config);
s3.listFiles().then((res) => {
console.log(res.data.Contents);
})
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels