Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.76k stars 887 forks source link

SyntaxError: Invalid or unexpected token for the file analysis-worker.js #21467

Closed josevarghese closed 2 months ago

josevarghese commented 3 months ago

Please give us a description of what happened

On two or three websites, we noticed that the Yoast SEO metabox became blank or the Readability tab kept spinning. As a result, metabox is not functioning and the AI feature was not working on those websites using the Yoast SEO Premium plugin.

Note: This issue is to track how many users are affected and to find out the issue causing this, as the issue is not occurring on the lab sites

To Reproduce

Step-by-step reproduction instructions

The below steps cannot be used to replicate it but to mention that the issue occurs when the Yoast SEO plugin is used.

  1. Install the Yoast SEO plugin
  2. Open a post editor, where you can see the metabox becomes blank.
  3. Error on the browser console is
    lodash.min.js?ver=4.17.21:9 Uncaught SyntaxError: Invalid or unexpected token (at lodash.min.js?ver=4.17.21:9:7828)
    at analysis-worker.js?ver=aa04978fbd423b404462:1:267
    at self.onmessage (analysis-worker.js?ver=aa04978fbd423b404462:1:331)

Expected results

  1. Yoast metabox is to load without any issues, and the Readability tab is to load without any spinning circles.

Actual results

  1. Yoast metabox becomes blank, and the Readability tab shows the spinning circles

Screenshots, screen recording, code snippet

If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.

browser-error

Technical info

Used versions

josevarghese commented 3 months ago

Please inform the customer of conversation # 1150146 when this conversation has been closed.

josevarghese commented 3 months ago

Please inform the customer of conversation # 1144412 when this conversation has been closed.

josevarghese commented 3 months ago

+1 Conversation # 1146039

We already refunded this customer

suascat commented 2 months ago
Server /setup info from setup of user` 1150146` just in case it helps in research. ``` ### wp-core ### version: 6.5.5 site_language: en_US user_language: en_US timezone: +10:00 permalink: /%year%/%monthnum%/%day%/%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: open environment_type: production user_count: 2 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /home/.../public_html wordpress_size: 507.97 MB (532648715 bytes) uploads_path: /home/.../public_html/wp-content/uploads uploads_size: 110.42 MB (115784010 bytes) themes_path: /home/.../public_html/wp-content/themes themes_size: 12.37 MB (12968221 bytes) plugins_path: /home/..../public_html/wp-content/plugins plugins_size: 208.66 MB (218795730 bytes) database_size: 190.61 MB (199873007 bytes) total_size: 1.01 GB (1080069683 bytes) ### wp-dropins (2) ### advanced-cache.php: true maintenance.php: true ### wp-active-theme ### name: Sydney (sydney) version: 2.40 author: aThemes author_website: https://athemes.com parent_theme: none theme_features: core-block-patterns, widgets-block-editor, block-templates, automatic-feed-links, title-tag, post-thumbnails, menus, html5, post-formats, custom-background, align-wide, appearance-tools, custom-header, infinite-scroll, widgets theme_path: /home/..../public_html/wp-content/themes/sydney auto_update: Disabled ### wp-themes-inactive (2) ### Twenty Twenty-Three: version: 1.4, author: the WordPress team, Auto-updates disabled Twenty Twenty-Two: version: 1.7, author: the WordPress team, Auto-updates disabled ### wp-mu-plugins (1) ### Health Check Troubleshooting Mode: author: (undefined), version: 1.9.1 ### wp-plugins-active (18) ### Elementor: version: 3.22.3, author: Elementor.com, Auto-updates enabled Elementor Header & Footer Builder: version: 1.6.36, author: Brainstorm Force, Nikhil Chavan, Auto-updates enabled Elementor Pro: version: 3.22.1, author: Elementor.com, Auto-updates enabled Fluent Forms: version: 5.1.19, author: Contact Form - WPManageNinja LLC, Auto-updates enabled FluentSMTP: version: 2.2.80, author: FluentSMTP & WPManageNinja Team, Auto-updates enabled Health Check & Troubleshooting: version: 1.7.0, author: The WordPress.org community, Auto-updates disabled Icon Element: version: 2.0.5, author: Webangon, Auto-updates enabled Image Optimizer by Elementor – Compress, Resize and Optimize Images: version: 1.4.1, author: Elementor.com, Auto-updates enabled Migrate Guru: version: 5.56, author: Migrate Guru, Auto-updates disabled Premium Addons for Elementor: version: 4.10.36, author: Leap13, Auto-updates enabled Prime Slider: version: 3.14.13, author: BdThemes, Auto-updates enabled Rank Math SEO: version: 1.0.222, author: Rank Math, Auto-updates enabled Site Kit by Google: version: 1.130.0, author: Google, Auto-updates enabled Spotlight - Social Media Feeds: version: 1.6.13, author: RebelCode, Auto-updates disabled Temporary Login Without Password: version: 1.8.3, author: StoreApps, Auto-updates disabled UpdraftPlus - Backup/Restore: version: 1.24.4, author: UpdraftPlus.Com, DavidAnderson, Auto-updates enabled WP Google Review Slider: version: 14.1, author: LJ Apps, Auto-updates disabled Yoast SEO: version: 23.0, author: Team Yoast, Auto-updates enabled ### wp-plugins-inactive (5) ### AirLift: version: 5.62, author: AirLift, Auto-updates disabled All In One WP Security: version: 5.3.1, author: All In One WP Security & Firewall Team, Auto-updates disabled NitroPack: version: 1.15.3, author: NitroPack Inc. (latest version: 1.16.2), Auto-updates disabled WP Fastest Cache: version: 1.2.8, author: Emre Vona, Auto-updates disabled Yoast SEO Premium: version: 23.0, author: Team Yoast, Auto-updates enabled ### wp-media ### image_editor: WP_Image_Editor_GD imagick_module_version: Not available imagemagick_version: Not available imagick_version: Not available file_uploads: 1 post_max_size: 128M upload_max_filesize: 128M max_effective_size: 128 MB max_file_uploads: 20 gd_version: 2.3.3 gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF, XPM ghostscript_version: unknown ### wp-server ### server_architecture: Linux 3.10.0-962.3.2.lve1.5.85.el7.x86_64 x86_64 httpd_software: LiteSpeed php_version: 8.1.29 64bit php_sapi: litespeed max_input_variables: 3000 time_limit: 300 memory_limit: 256M max_input_time: 120 upload_max_filesize: 128M php_post_max_size: 128M curl_version: 7.87.0 OpenSSL/1.1.1w suhosin: false imagick_availability: false pretty_permalinks: true htaccess_extra_rules: true current: 2024-07-08T21:27:04+00:00 utc-time: Monday, 08-Jul-24 21:27:04 UTC server-time: 2024-07-09T07:26:58+10:00 ### wp-database ### extension: mysqli server_version: 10.6.18-MariaDB client_version: mysqlnd 8.1.29 max_allowed_packet: 1073741824 max_connections: 200 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /home/..../public_html/wp-content WP_PLUGIN_DIR: /home/..../public_html/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined WP_DEVELOPMENT_MODE: undefined DB_CHARSET: utf8mb4 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### google-site-kit ### version: 1.130.0 php_version: 8.1.29 wp_version: 6.5.5 reference_url: https://example.com.au amp_mode: no site_status: not-connected user_status: not authenticated verification_status: not-verified connected_user_count: 1 active_modules: site-verification, search-console, analytics-4, pagespeed-insights recoverable_modules: none required_scopes: openid: ⭕ https://www.googleapis.com/auth/userinfo.profile: ⭕ https://www.googleapis.com/auth/userinfo.email: ⭕ https://www.googleapis.com/auth/siteverification: ⭕ https://www.googleapis.com/auth/webmasters: ⭕ https://www.googleapis.com/auth/analytics.readonly: ⭕ https://www.googleapis.com/auth/tagmanager.readonly: ⭕ capabilities: googlesitekit_authenticate: ✅ googlesitekit_setup: ✅ googlesitekit_view_posts_insights: ⭕ googlesitekit_view_dashboard: ⭕ googlesitekit_manage_options: ⭕ googlesitekit_update_plugins: ⭕ googlesitekit_view_splash: ✅ googlesitekit_view_authenticated_dashboard: ⭕ googlesitekit_view_wp_dashboard_widget: ⭕ googlesitekit_view_admin_bar_menu: ⭕ googlesitekit_view_shared_dashboard: ⭕ googlesitekit_read_shared_module_data::["search-console"]: ⭕ googlesitekit_read_shared_module_data::["analytics-4"]: ⭕ googlesitekit_read_shared_module_data::["pagespeed-insights"]: ⭕ googlesitekit_manage_module_sharing_options::["search-console"]: ⭕ googlesitekit_manage_module_sharing_options::["analytics-4"]: ⭕ googlesitekit_manage_module_sharing_options::["pagespeed-insights"]: ⭕ googlesitekit_delegate_module_sharing_management::["search-console"]: ⭕ googlesitekit_delegate_module_sharing_management::["analytics-4"]: ⭕ googlesitekit_delegate_module_sharing_management::["pagespeed-insights"]: ⭕ enabled_features: adsPax: ⭕ audienceSegmentation: ⭕ consentModeSwitzerland: ⭕ conversionInfra: ⭕ gm3Components: ⭕ rrmModule: ⭕ consent_mode: disabled consent_api: not-detected search-console_shared_roles: none search-console_management: owner analytics-4_shared_roles: none analytics-4_management: owner pagespeed-insights_shared_roles: none pagespeed-insights_management: all_admins search_console_property: https://example.com.au/ analytics_4_account_id: 1206••••• analytics_4_property_id: 3671165•• analytics_4_web_data_stream_id: 4983•••••• analytics_4_measurement_id: G-W3•••••••• analytics_4_use_snippet: yes analytics_4_ads_conversion_id: none analytics_4_available_custom_dimensions: none analytics_4_ads_linked: false analytics_4_ads_linked_last_synced_at: undefined ```
amboutwe commented 2 months ago

After many unsuccessful tests, we reproduced the issue and found it occurs with invalid response headers. When the server marks JavaScript files with the content-type of application/javascript; charset=utf8mb4, it breaks in Chrome but not in Firefox. Note that usually this value is just application/javascript.

We confirmed that changing the value to known invalid charset (random string) produces the same behavior which means that the charset utf8mb4 is not valid as it's rarely used outside of SQL. Setting it to a valid charset directive like utf-8 resolved the issue in our test environment.

Although response headers are commonly set within your web host control panel, WordPress security plugins may offer these features. Please modify the behavior to use a valid charset.