• Resolved jqz

    (@jqz)


    On fresh WordPress install, with only AIO installed, the import from file stalls right at the start, with about 1% complete. Console log shows errors:

    load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2

       POST https://wp.ofs.org.uk/wordpress/wp-admin/admin-ajax.php?action=ai1wm_import&ai1wm_import=1 404 (Not Found)

    send @ load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2
    ajax @ load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2
    (anonymous) @ load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:5
    e. @ load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:5
    webpack_modules.814.FileUploader.upload @ import.min.js?v=7.81&ver=6.5.2:1315
    (anonymous) @ import.min.js?v=7.81&ver=6.5.2:1192
    webpack_modules.936.Import.checkDiskSpace @ import.min.js?v=7.81&ver=6.5.2:363
    (anonymous) @ import.min.js?v=7.81&ver=6.5.2:1186
    dispatch @ load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2
    v.handle @ load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2

    import.min.js?v=7.81&ver=6.5.2:1345 Uncaught Error: error
    at Object.error (import.min.js?v=7.81&ver=6.5.2:1345:13)
    at c (load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2:25304)
    at Object.fireWith as rejectWith
    at l (load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2:77807)
    at XMLHttpRequest. (load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.5.2:2:80265)

    I’ve set WP_DEBUG and WP_SCRIPT_DEBUG but found nothing logged. I’ve checked with a hard-coded error_log that something would be logged – nothing is.

    If I try to re-import the exported file into localhost it seems like it would work. It gets as far as prompting me to confirm I want to overwrite data. But on the new remote site, it doesn’t even get that far.

    What could be going wrong, and how can I diagnose the problem?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter jqz

    (@jqz)

    More info:

    When it works, the following hooks are run:

    ‘Ai1wm_Import_Upload::execute’
    ‘Ai1wm_Import_Compatibility::execute’
    ‘Ai1wm_Import_Validate::execute’
    ‘Ai1wm_Import_Check_Encryption::execute’
    ‘Ai1wm_Import_Check_Decryption_Password::execute’
    ‘Ai1wm_Import_Confirm::execute’
    ‘Ai1wm_Import_Clean::execute’

    When it doesn’t, only Ai1wm_Import_Clean::execute is run. Why might that be?

    Thread Starter jqz

    (@jqz)

    Successful case has the following $_REQUEST parameters in first AJAX call:

    ‘action’ => ‘ai1wm_import’,
    ‘ai1wm_import’ => ‘1’,
    ‘priority’ => ‘5’,
    ‘secret_key’ => ‘xxx’,
    ‘storage’ => ‘xxx’,
    ‘archive’ => ‘xxx.wpress’,
    ’em_ajax’ => true,

    Failing case has only the first two. Why would the other parameters have gone AWOL?

    Thread Starter jqz

    (@jqz)

    It seems that the server has a limit of 2Mb for the size of the request (POST) payload. Anything more than that results in the entire payload being silently dropped (or at least I can’t find where any error is logged), with the request continuing to be processed as if nothing had gone wrong. In cPanel’s PHP settings, post_max_size is 128M and upload_max_filesize is 1G. However, Apache’s LimitRequestBody setting could be having an impact…

    Media Library also fails to upload files more than 2Mb, but at least provides a vague error message: “Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.” Rather than stalling completely.

    It would be good if you had error handling for this situation, which must surely be quite common, and perhaps provide a more informative error message than WordPress does.

    • This reply was modified 7 months, 2 weeks ago by jqz.
    Thread Starter jqz

    (@jqz)

    I found it was Apache’s LimitRequestBody setting. I’d based my .htaccess file on one I found elsewhere that had that 2Mb restriction put in place (with a comment that it was to allow large form-data posts – obviously the server it was used with had an even lower restriction), probably from an era where files were not normally uploaded via JavaScript XHR.

    So my problem is solved, but some error handling with suggestions for settings to change wouldn’t go amiss to help others who encounter upload size limitations.

    Plugin Author Yani

    (@yaniiliev)

    Thank you for sharing your solution regarding the Apache’s LimitRequestBody setting affecting your upload capacity. You’re right; web server settings like these can indeed impact the functionality of plugins that handle large files.

    Regarding the error handling, the All-in-One WP Migration plugin operates within the PHP environment and, unfortunately, cannot detect or suggest changes for settings managed at the web server level, such as those in Apache or Nginx. For issues related to server configurations, we typically recommend reaching out to your hosting provider, as they can provide direct assistance and make necessary adjustments.

    We appreciate your feedback and will consider how we might improve guidance for users facing similar issues in the future.

    Thread Starter jqz

    (@jqz)

    I disagree re error handling. You can detect this issue from the PHP and/or JavaScript code. As pointed out above, when the POST payload exceeds the maximum size, the request is received with the POST data missing. So you could check for that in the PHP AJAX handler and return something to indicate the data was missing (which is suggestive of a POST size limitation issue). And/or you could handle the Error exception in the JavaScript which makes the AJAX request, to abort the upload and report that it failed, rather than having the progress bar stuck on 0.78% (or whatever) forever with no further feedback.

    Also as pointed out above, WordPress’s Media Library upload does report an error in a similar situation (albeit a bit vague).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Javascript AJAX error at start of upload’ is closed to new replies.