File uploaded but error msg "File Upload Disconnected. Please try again." [ERPNext V9.1]

File successfully uploaded but got error msg and js error.

Uncaught TypeError: Cannot read property 'slice' of null
    at n.<anonymous> (desk.min.js?ver=1530266827.0:1953)
    at n.emit (libs.min.js?ver=1530266827.0:7301)
    at n.onevent (libs.min.js?ver=1530266827.0:7302)
    at n.onpacket (libs.min.js?ver=1530266827.0:7302)
    at n.<anonymous> (libs.min.js?ver=1530266827.0:7302)
    at n.emit (libs.min.js?ver=1530266827.0:7301)
    at n.ondecoded (libs.min.js?ver=1530266827.0:7301)
    at s.<anonymous> (libs.min.js?ver=1530266827.0:7302)
    at s.n.emit (libs.min.js?ver=1530266827.0:7301)
    at s.add (libs.min.js?ver=1530266827.0:7301)

Only happens with private file upload.

It’s happened because of production server setup.

Why?
because bench install --production command install nginx and supervisor automatically and create the symlink with config(nginx.conf and supervisor.conf) files.

Nginx use the sockets to communicate with python module and bind the socket with port number.

If socket/port number is already in use by nginx and you’re also trying to run the erp using bench start command then definitely you’ll face this issue.

Solution:
Stop the bench start (ctrl ^c) and use supervisor service(sudo supervisorctl restart frappe) to run your erp in production mode.

1 Like

I’m not sure but it might related as I bench restart a few time.
Everything works.

I cloned server image and run on new server, then this happened.