• Resolved davedecc

    (@davedecc)


    Recently we had an issue where when autoptimize was enabled it created a 500 error for the Pie Calendar plugin, I’m guessing this has to do with not putting in the right exceptions, but also figured I would share the error here in case it’s a wider issue:

    PHP Fatal error: Uncaught JSMin_UnterminatedStringException: JSMin: Unterminated String at byte 5043: ” in /home/redacted/public_html/production/wp-content/plugins/autoptimize/classes/external/php/jsmin.php:212
    Stack trace: 0 /home/redacted/public_html/production/wp-content/plugins/autoptimize/classes/external/php/jsmin.php(150): JSMin->action(1) 1 /home/redacted/public_html/production/wp-content/plugins/autoptimize/classes/external/php/jsmin.php(84): JSMin->min() 2 /home/redacted/public_html/production/wp-content/plugins/autoptimize/classes/autoptimizeSpeedupper.php(38): JSMin::minify(‘(()=>{var Ye=!1…’) 3 /home/redacted/public_html/production/wp-includes/class-wp-hook.php(324): autoptimizeSpeedupper->js_snippetcacher(‘(()=>{var Ye=!1…’, ‘/home/redact…’) 4 /home/redacted/public_html/production/wp-includes/plugin.php(205): WP_Hook->apply_filters(‘(()=>{var Ye=!1…’, Array) 5 /home/redacted/public_html/production/wp-content/plugins/autoptimize/classes/autoptimizeScripts.php(587): apply_filters(‘autoptimize_js_…’, ‘(()=>{var Ye=!1…’, ‘/home/redact…’) 6 /home/redacted/public_html/production/wp-content/plugins/autoptimize/classes/autoptimizeMain.php(592): autoptimizeScripts->minify() 7 [internal function]: autoptimizeMain->end_buffering(‘…’, 9) 8 {main}

    thrown in /home/redacted/public_html/production/wp-content/plugins/autoptimize/classes/external/php/jsmin.php on line 212

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    hi Dave; that’s the JS minifier (a 3rd party component used in AO to minify the JS) crashing out due to a missing “string termination” character (likely a missing double quote after a string). it is likely this is caused by a little bug in the “pie calendar” plugin.

    hope this helps,
    frank

    Hey Frank, Pie Calendar dev here.

    Thanks for pointing us in the right direction!

    I did a quick search and couldn’t find any JS files with string termination errors as indicated above. I would expect an improperly terminated string in one of our JS files to be throwing console errors during normal use, which we monitor for during dev/testing and haven’t seen, so I wonder if there’s something else at play here.

    Is there any way to find out which specific file the minifier is failing on? That would be really helpful.

    @davedecc In case Frank can’t provide a way to pin down the specific file causing the problem, I’d start by excluding these Pie Calendar files from minification:

    • includes/js/metabox-pro-recurrence-ui.js
    • includes/js/piecal-utils-pro.js
    • includes/js/piecal-utils.js
    • build/index.js
    • build/blocks/calendar/index.js
    • build/blocks/event-info/index.js

    If excluding those files fixes the errors, please remove the exclusions one by one until the error comes back to identify the specific file the minifier is failing on, and let me know what you find.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    there’s a very small snippet of the code in the error backtrace, (()=>{var Ye=!1, maybe that is a pointer in the right direction @spellhammer ?

    Thanks @optimizingmatters !

    I didn’t recognize that snippet, so I didn’t think to search it up in our code, but thanks to your advice I found that snippet exists in vendor/alpine.3.11.1.js. Great!

    Unfortunately, that’s a third-party file (a library we use for front-end reactivity) and is already minified. I think the best path here for @davedecc would be to exclude this file since I’m assuming double-minifying a JS file is bad news.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, but if the file is minified already, then consider changing the name to vendor/alpine.3.11.1.min.js maybe, that way AO *knows* it does not have to bother minifying it again 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.