jqueryruby-on-rails-3jquery-pluginsjquery-file-uploadjquery-fileupload-rails

jquery-fileupload: getting "TypeError undefined function" error in production environment only


I'm using the latest version of blueimp's jquery-fileupload library in a rails 3.2.18 application.

Everything is working correctly in my development environment, but when I deploy to a production environment, I get the following error:

TypeError: undefined is not a function (evaluating 'fu._adjustMaxNumberOfFiles(-files.length)')

This was related to a change in the json result handling in the jquery-fileupload library. The necessary fixes were successfully applied to the codebase (at least, working in development)

I assumed the issue may be related to the asset pipeline -- that js files were not being properly included into the page, but as far as I can tell this is not the case. What differences between development and production would result in this type of jscript error?


Solution

  • This was actually due to changes in the jquery-fileupload library. Basically, we were referencing a private function (_adjustMaxNumberOfFiles) which appears to have been deprecated in newer versions of the code.

    Removing this line caused the code to function properly across environments.