-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Uncaught TypeError: Cannot read property 'upload' of undefined #1372
Comments
What version are you using, and what noticeable issue does this error cause (other than the log message)? On Sun, Feb 22, 2015 at 11:41 AM, thomas83 [email protected]
|
Wow that was some quick response. There are no noticeable issues. I'm making a wrapper on top of this, so I wanted to make sure every single point goes clear and working the way it's supposed to be. It could be my problem, but I kinda doubt it this time. I'm using the latest version I downloaded today. /*!
|
I believe I have seen this log message in the past. As you suggested, it is only noticeable when concurrent chunking is enabled. It can be reproduced when an in progress concurrently chunked upload is canceled. When an upload of this type fails, fine uploader cancels all chunks (internally), so that is why you are seeing the issue. I believe the error log message is benign, but I'll look closer before 5.2 is released. On Sun, Feb 22, 2015 at 11:48 AM, thomas83 [email protected]
|
Thanks Ray! |
I'm not able to reproduce this issue in the develop branch as of 5.2.0-20, so I'm going to assume this has been fixed somehow. If you're able to reproduce in the dev branch w/ 5.2.0. please let me know. |
I noticed this error today after a user reported that uploads didn't work for them User agent FineUploader Version 5.5.0
|
Can you elaborate on "didn't work"?
|
I suspect the upload stalled on their mobile device due to mobile network quality issues and was then manually aborted. We didn't receive a final upload failure notice. I just wanted to add this here for reference in case someone looks for context of this warning in future. |
Can you paste your fine uploader initialization code here? |
Here is the relevant section that I extracted from the compiled production js ...
function() {
this.FileUploader = function() {
function e(e, t) {
null == t && (t = {}), this.el = e, this.options = t, this.setupUploader()
}
return e.prototype.setupUploader = function() {
var e, t;
return t = this, e = null, this.el.fineUploaderS3({
uploaderType: "basic",
button: this.el,
multiple: this.options.multiple,
maxConnections: this.options.maxConnections || 3,
validation: {
acceptFiles: this.options.acceptFiles || null,
sizeLimit: this.options.sizeLimit || 0,
minSizeLimit: this.options.minSizeLimit || 0,
allowedExtensions: this.options.allowedExtensions || []
},
request: {
endpoint: "https://xxx.s3-eu-west-1.amazonaws.com",
accessKey: "XXX"
},
objectProperties: {
acl: this.options.acl || "public-read",
key: function(e) {
var n, i, r;
return r = "production/" + qq.getUniqueId(), i = this.getName(e), n = t.options.extension || qq.getExtension(i), void 0 !== n && (r += "." + n), r
}
},
signature: {
endpoint: "/upload_signatures",
customHeaders: {
"X-CSRF-Token": $("meta[name=csrf-token]").attr("content")
}
},
uploadSuccess: {
customHeaders: {
"X-CSRF-Token": $("meta[name=csrf-token]").attr("content")
},
endpoint: this.options.endpoint,
params: this.options.params || {}
},
chunking: {
enabled: !0,
concurrent: {
enabled: !0
}
},
resume: {
enabled: !0
},
iframeSupport: {
localBlankPagePath: "/upload_success.html"
},
retry: {
autoAttemptsDelay: this.options.autoAttemptsDelay || 5,
maxAutoAttempts: this.options.maxAutoAttempts || 20,
enableAuto: !0
}
}
.... |
Seems to be related to #1519. Have a look at that case for a possible solution. |
hey there @rnicholus - I have this issue you mentioned - I have a multi-chunked upload I'm cancelling and get this error... although it's benign like you said, and it doesn't bother FU to continue to the next file, it's still not a cool thing to have this error thrown. WDYT? Uncaught TypeError: Cannot read property 'chunking' of undefined |
This happens only when chunk is enabled, on S3 mode.
Turn on debug mode, then try to upload a big file, then disconnect wifi in the middle. Wait for a bit, until 3 retries are over.
Then, there will be an error:
Uncaught TypeError: Cannot read property 'upload' of undefineds3.jquery.fine-uploader.js:5594 qq.extend._registerProgressHandlers3.jquery.fine-uploader.js:9434 chunked.put.chunked.initHeaders.then.promise.failure.errors3.jquery.fine-uploader.js:1109 (anonymous function)s3.jquery.fine-uploader.js:659 qq.eachs3.jquery.fine-uploader.js:1108 qq.extend.successs3.jquery.fine-uploader.js:9418 (anonymous function)s3.jquery.fine-uploader.js:1109 (anonymous function)s3.jquery.fine-uploader.js:659 qq.eachs3.jquery.fine-uploader.js:1108 qq.extend.successs3.jquery.fine-uploader.js:8494 handleSignatureReceiveds3.jquery.fine-uploader.js:3804 onCompletes3.jquery.fine-uploader.js:3909 (anonymous function)
I've investigated a bit on this...
On line 5560, this gets called: _registerProgressHandler()
On line 5561, it will try to use the handler to get xhr. Unfortunately, it fails to get the xhr.
On line 5594, without checking xhr variable, it tries to assign a new function on top of xhr.upload, and boom, "Cannot read property 'upload'".
I advise to resolve the issue by making a check right before definition of the function.
Something like...
Btw, I do notice that while most of the time this happens, everyone once a while this does not. I'm not sure about the whole flow of the code, or how the threading works here, but yeah, that's how I see the bug currently.
Last but not least I thought this whole fineuploader thing was really well made. Really love it a lot.
Thanks guys!
Cheers,
Thomas
The text was updated successfully, but these errors were encountered: