Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xhr-upload error handling: Uncaught TypeError: can't access property "log", this.uppy is undefined #3222

Closed
markodvornik opened this issue Sep 22, 2021 · 1 comment

Comments

@markodvornik
Copy link

When uploading with xhr-upload plugin and response from the server is not parsable by JSON.parse uppy try-catches the error and tries to log it:

but it seems that at that point uppy.log is undefined and getResponseData(responseText) throws a fatal error.

Solution

The logger should be defined or removed. Logging should not throw a fatal error.

Environment

    "@uppy/core": "2.0.3",
    "@uppy/drag-drop": "2.0.2",
    "@uppy/react": "2.0.3",
    "@uppy/xhr-upload": "2.0.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",

To reconstruct try to create a blank server response.

Server request
Method POST
Content-Type: multipart/form-data; boundary=---------------------------3625714102890612418576554156
Content-Length: 58103

Server response
HTTP/1.1 202 Accepted
Content-Length: 0
Transfered 59,98 KB (0 B size)

(Response is blank, but status returned is 202.)

Trace

Uncaught TypeError: can't access property "log", this.uppy is undefined
    getResponseData index.js:116
    upload index.js:287
    upload index.js:276
    upload index.js:244
    promises index.js:564
    uploadFiles index.js:552
    handleUpload index.js:627
    _runUpload2 index.js:1887
    upload index.js:1377
    promise callback*upload index.js:1360
    scheduledAutoProceed index.js:1633
    setTimeout handler*_startIfAutoProceed2 index.js:1631
    addFiles index.js:753
    addFiles index.js:76
    onInputChange index.js:85
    Preact 11
    mount UIPlugin.js:96
    install index.js:228
    use index.js:1116
    installPlugin DragDrop.js:48
    componentDidMount DragDrop.js:24
    React 6
    unstable_runWithPriority scheduler.development.js:468
    React 4
    unstable_runWithPriority scheduler.development.js:468
    runWithPriority$1 React
@Murderlon
Copy link
Member

Hi, this was raised in #3195 and solved in #3207. Closing as duplicate. Thanks for reporting though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants