Trying to use a presigned-url for aws but I keep getting the error when I try to upload a photo:
[Uppy] [15:26:41] Failed to upload buffalo1.jpg AwsS3: got incorrect result from 'getUploadParameters()' for file 'buffalo1.jpg', expected an object '{ url, method, fields, headers }' but got 'undefined' instead.
I have everything set up just as the documentation advises. Can anyone take a look and tell me what it is that I might be missing?
const uppy = useUppy(() => {
return new Uppy({ autoProceed: true }).use(AwsS3, {
getUploadParameters(file) {
return fetch(
`${process.env.baseUrl}/api/asset/presign/upload?assetId=${props.asset.id}&key=${file.id}&contentType=${file.type}`
)
.then((res) => {
return res.json()
})
.then((data) => {
return {
method: data.method, //data.method,
url: data.url,
fields: {},
headers: {
"Content-Type": file.type,
},
};
})
.catch((err) => {
console.log("error: ", err);
});
},
});
});