Closed Alagaesia93 closed 6 years ago
@Alagaesia93 can you please share your uppy client code snippet? Are you using a custom getResponseData
function?
Hi @ifedapoolarewaju, thank you for your quick response. Here you find my code. Ignore all italian locales :-)
function init_uppy(){
var uppy = Uppy.Core({
autoProceed: true
})
.use(Uppy.Dashboard, {
target: '.upload-dashboard',
inline: true,
note: 'La velocità di caricamento dipende dalla tua connessione internet'
})
.use(Uppy.Webcam, {target: Uppy.Dashboard, countdown: 3})
.use(Uppy.Dropbox, {target: Uppy.Dashboard, host: 'http://localhost:3020'})
.use(Uppy.GoogleDrive, {target: Uppy.Dashboard, host: 'http://localhost:3020'})
.use(Uppy.AwsS3, {
getUploadParameters (file) {
var host = "/s3_sign"
console.log("host is "+host)
if (!cachedParameters) { // avoid a different call for each file
cachedParameters = fetch(host, {
credentials: 'include',
mode: 'cors'
}).then((response) => {
return response.json();
}).then((data) => {
return {
method: 'post',
url: 'my_bucket_url',
fields: data
}
});
}
return cachedParameters;
}
})
.on('file-added', (file) => {
$("#btn-upload-step").attr("disabled", true)
})
.on('upload-success', (file, resp, uploadURL) => {
uploadURL = decodeURIComponent(uploadURL)
var exif = {}
if (file.type.indexOf ("image") >= 0) {
getExif(uploadURL, file);
} else {
upload_to_our_site(uploadURL, file, {when: "", when_date_time: "", profile_date_time: "", where: "", who: [""], tag_list: ""})
}
})
.run();
}
if (typeof Uppy != "undefined"){
init_uppy()
}
ah I see the issue now, it seems to be a bug on uppy client. @goto-bus-stop it seems AwsS3
plugin handles xhr response ignorant of the fact that it is not always an xhr instance
Oh yeah. Thanks for figuring that out :v:
Thank you guys for your quick answers!
Is there anything I can do to avoid this error? Is there anything I can do to help you?
closing this in favor of this https://github.com/transloadit/uppy/pull/711
Hi guys,
thank you for this awesome library! I have a little issue, I'm not very skilled in js and I can't find a solution.
I have a rails app running on port 3452 (as described here) with Uppy up and running. Everything works like a charm when I upload files or take a photo from my webcam, it uploads correctly on my s3-bucket and I'm super happy. Now I want to extend, with uppy-server, for dropbox, drive & co.
As explained in the docs I copied uppy server, installed, set keys in env.sh (they are test keys, I'll change them lol)
export UPPYSERVER_SECRET="this_is_a_fucking_secret"
export UPPYSERVER_DOMAIN="localhost:3020"
export UPPYSERVER_DATADIR="/alagaesias_output"
both in uppy.js (in options variable) and in env.sh.
Now I try to gather a file from Dropbox from localhost:3452, it shows me all my files, I select a photo, it starts the upload and never completes, with a js error in console. This is the console log, with debug options set to true and attached image:
UppySocket.js:54 progress UppySocket.js:54 success UppySocket.js:54 error UppySocket.js:70 {action: "progress", payload: {…}} UppySocket.js:59 progress UppySocket.js:70 {action: "success", payload: {…}} UppySocket.js:59 success UppySocket.js:73 TypeError: e.getResponseHeader is not a function at w (index.js:7) at Object.getResponseData (index.js:141) at Function. (XHRUpload.js:325)
at index.js:131
at Object.e.emit (index.js:124)
at e.emit (UppySocket.js:60)
at e._handleMessage (UppySocket.js:71)
What is the error? How can I solve it?
Please note I can find the uploaded file (from Dropbox) in my s3-bucket, so the upload works, but I suppose it raises an error somewhere, and same thing happens with Drive.
Uppy Client is included via CDN, Uppy Server is up and running in npm.
Thank you very much in advance!