Here is my code for the awss3 object:
awss3: {
signingURL: (file) => {
console.log('about to process file: ', file.name)
return api.getSignedUrl({ fileName: file.name})
.then((url) => {
console.log('url is: ', url)
return url
})
.catch((err) => {
console.error('Failed to get an S3 signed upload URL', err)
})
},
headers: {},
params : {},
sendFileToServer : true,
withCredentials: true
}
When I drop a file in, I get this 400 error: POST http://localhost:8080/[object%20Promise] 404 (Not Found)
And a few seconds after this message, the promise resolves and the signed URL gets logged to the console.
Am I missing something about how this is meant to work?
@BFriedman117 It seems that your signing URL is returned late and your request is directly sent to promise. Can you provide function there instead of promise? Extract your promise to the new function and pass the file name to that function. Make sure your function returns only when a promise is resolved.
E.g.
awss3: {
signingURL: this.getUrl(file),
headers: {},
params : {},
sendFileToServer : true,
withCredentials: true
}
....
methods:{
geUrl(file){
return api.getSignedUrl({ fileName: file.name})
.then((url) => {
return url
})
.catch((err) => {
console.error('Failed to get an S3 signed upload URL', err)
})
}
}
Thanks for your response. However, this method has the same result.
While it would be good if Vue Dropzone supported promise based functions for getting the URL, I am on a time deadline.
What URL should I be passing in to get this to work? If the signingURL function returns my hard coded api route, I get an error 'cannot convert undefined to object' from @vdropzone-s3-upload-error.
So hard coding a URL doesnt seem to work and fetching the signing URL myself from Amazon doesnt work either. What is the expected URL supposed to be or to do?
Seems like this is still an open issue, but would love to figure this out as well.
+1. If used in a typical api setup, we need to handle things like token refreshes before returning the url.
I have the same issue. Any workaround?
@vschimpf I ended up using Uppy with the S3 add on, working well.
Most helpful comment
@vschimpf I ended up using Uppy with the S3 add on, working well.