I have been trying to upload values to s3 using this node: https://www.npmjs.com/package/aws-s3
And this code:
import {S3} from 'aws-s3';
const config = {
bucketName: 'creative.example.uploads',
dirName: 'photos', /* optional */
region: 'eu-west-2',
accessKeyId: 'AKIATXEXAMPLECK3QTMB',
secretAccessKey: 'Zx5pBhF16XqPAP/jztExampleRJ5He344D/yRm9J',
s3Url: 'https://my-s3-url.com/', /* optional */
}
const S3Client = new S3(config);
/* Notice that if you don't provide a dirName, the file will be automatically uploaded to the root of your bucket */
/* This is optional */
const newFileName = 'my-awesome-file';
S3Client
.uploadFile($w("#uploadButton1").value, newFileName)
.then(data => console.log(data))
.catch(err => console.error(err))
/**
* {
* Response: {
* bucket: "your-bucket-name",
* key: "photos/image.jpg",
* location: "https://your-bucket.s3.amazonaws.com/photos/image.jpg"
* }
* }
//});
However whenever I turn the code this error flags up:
I do not really understand the code to begin with and I am not sure why this error is occurring. I am also not sure how to call the code to make it function.
Any help would be very much appreciated as I have been stuck on this for ages.