Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMP setting breaks with WooCommerce and TwentyTwentytwo theme. #7380

Closed
milindmore22 opened this issue Dec 22, 2022 · 5 comments · Fixed by #7406
Closed

AMP setting breaks with WooCommerce and TwentyTwentytwo theme. #7380

milindmore22 opened this issue Dec 22, 2022 · 5 comments · Fixed by #7406
Labels
Bug Something isn't working Changelogged Whether the issue/PR has been added to release notes.
Projects
Milestone

Comments

@milindmore22
Copy link
Collaborator

Bug Description

We have received two support topics Topic 1 and Topic 2 Both users are using WoCommerce 7.2.0+ and TwentyTwentyTwo 1.3 themes both users are not able to access the AMP settings

Console error

{
  "message": "Cannot read properties of null (reading 'type')",
  "stack": "TypeError: Cannot read properties of null (reading 'type')\n    at https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:14:37931\n    at https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:14:38275\n    at Object.Oi [as useMemo] (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:1:349875)\n    at t.useMemo (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:1:412296)\n    at ts (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:14:37404)\n    at ii (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:1:345171)\n    at Ri (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:1:354689)\n    at Is (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:1:397967)\n    at kc (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:1:384325)\n    at zc (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=f246a3392e8ac166ba50:1:384253)"
}

Updated WooCommerce plugin to 7.2.2 after receiving updates still seeing same issue.

The issue can be reproducible on https://amp-support.rt.gw/

Expected Behaviour

Users should be able to access AMP settings

Screenshots

image

PHP Version

8.1.10

Plugin Version

2.3

AMP plugin template mode

Reader

WordPress Version

6.1.1

Site Health

  1. https://insights.amp-wp.org/admin/report/uuid/ampwp-8b760253-6821-5d21-b1d1-07872a1534a2
  2. https://insights.amp-wp.org/admin/report/uuid/ampwp-aa765171-787b-551e-a79c-0cbf70e9acf9

version: 6.1.1
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: undefined
https_status: true
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: production
user_count: 5
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: /var/www/htdocs/current
wordpress_size: 426.59 MB (447311382 bytes)
uploads_path: /var/www/htdocs/current/wp-content/uploads
uploads_size: 185.72 MB (194743365 bytes)
themes_path: /var/www/htdocs/current/wp-content/themes
themes_size: 240.27 MB (251938325 bytes)
plugins_path: /var/www/htdocs/current/wp-content/plugins
plugins_size: 376.71 MB (395008886 bytes)
database_size: 28.03 MB (29392896 bytes)
total_size: 1.23 GB (1318394854 bytes)

### wp-active-theme ###

name: Twenty Twenty-Two (twentytwentytwo)
version: 1.3
author: the WordPress team
author_website: https://wordpress.org/
parent_theme: none
theme_features: core-block-patterns, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, woocommerce, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, block-templates, widgets-block-editor, wp-block-styles, editor-style
theme_path: /var/www/htdocs/current/wp-content/themes/twentytwentytwo
auto_update: Disabled

### wp-themes-inactive (34) ###

Newspaper: version: 12, author: tagDiv, Auto-updates disabled
Amperion: version: 1.0.0, author: milindmore22, Auto-updates disabled
Artpop: version: 1.1.1, author: Design Lab, Auto-updates disabled
Astra: version: 3.9.4, author: Brainstorm Force, Auto-updates disabled
Blocksy: version: 1.8.62, author: CreativeThemes, Auto-updates disabled
ColorMag: version: 2.1.5, author: ThemeGrill, Auto-updates disabled
Deep: version: 1.0.6, author: WEBNUS, Auto-updates disabled
Exponent: version: 1.2.9.5, author: Brand Exponents, Auto-updates disabled
GeneratePress: version: 3.2.4, author: Tom Usborne, Auto-updates disabled
Jannah: version: 5.4.10, author: TieLabs, Auto-updates disabled
Maktub Child: author: EstudioPatagon, version: (undefined), Auto-updates disabled
Maktub: version: 1.3.0, author: EstudioPatagon, Auto-updates disabled
mcms Lite: version: 1.1.8, author: Roland Farkas @ Polarize Ltd, Auto-updates disabled
Neve: version: 3.4.9, author: ThemeIsle, Auto-updates disabled
Newspack: version: 1.39.3, author: Automattic, Auto-updates disabled
OceanWP: version: 3.3.6, author: OceanWP, Auto-updates disabled
Oxygen: version: 0.6.0, author: AlienWP, Auto-updates disabled
Publisher | XterNull.com: version: 7.11.0, author: XterNull.com, Auto-updates disabled
Rehub theme: version: 17.9.3, author: Wpsoul, Auto-updates disabled
Storefront: version: 4.2.0, author: Automattic, Auto-updates disabled
Twenty Eleven: version: 4.2, author: the WordPress team, Auto-updates disabled
Twenty Fourteen: version: 3.5, author: the WordPress team, Auto-updates disabled
Twenty Nineteen: version: 2.4, author: the WordPress team, Auto-updates disabled
Twenty Seventeen: version: 3.1, author: the WordPress team, Auto-updates disabled
Twenty Sixteen: version: 2.8, author: the WordPress team, Auto-updates disabled
Twenty Twelve: version: 3.8, author: the WordPress team, Auto-updates disabled
Twenty Twenty: version: 2.1, author: the WordPress team, Auto-updates disabled
Twenty Twenty-One: version: 1.7, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Three: version: 1.0, author: the WordPress team, Auto-updates disabled
Veen Child: author: EstudioPatagon, version: (undefined), Auto-updates disabled
Veen: version: 2.5.2, author: EstudioPatagon, Auto-updates disabled
Viral News: version: 1.4.64, author: HashThemes, Auto-updates disabled
Zeen Child: version: 1.0.0, author: Codetipi, Auto-updates disabled
Zeen: version: 4.2.2, author: Codetipi, Auto-updates disabled

### wp-plugins-active (3) ###

AMP: version: 2.3.0, author: AMP Project Contributors, Auto-updates disabled
Login with Google: version: 1.3.1, author: rtCamp, Auto-updates disabled
WooCommerce: version: 7.2.2, author: Automattic, Auto-updates disabled

### wp-plugins-inactive (56) ###

Akismet Anti-Spam: version: 5.0.2, author: Automattic, Auto-updates disabled
AMP Disable ES Modules by Default: version: 0.1, author: Weston Ruter, Auto-updates disabled
AMP Enhancer: version: 1.0.47, author: ampenhancer, Auto-updates disabled
AMP Plugin Name Compat: version: 0.1, author: Your Name, Google, Auto-updates disabled
AMP Popup: version: 0.1, author: Your Name Here, Auto-updates disabled
AMP Tawk.to Chat: version: 0.1, author: milindmore22, rtCamp, Google, Auto-updates disabled
Classic Editor: version: 1.6.2, author: WordPress Contributors, Auto-updates disabled
Classic Widgets: version: 0.3, author: WordPress Contributors, Auto-updates disabled
Cloudflare: version: 4.11.0, author: Cloudflare, Inc., Auto-updates disabled
CoBlocks: version: 2.25.4, author: GoDaddy (latest version: 2.25.5), Auto-updates disabled
Complianz | GDPR/CCPA Cookie Consent: version: 6.3.6.1, author: Really Simple Plugins, Auto-updates disabled
Contact Form 7: version: 5.7.1, author: Takayuki Miyoshi, Auto-updates disabled
Crowdsignal Forms: version: 1.6.6, author: Automattic, Auto-updates disabled
Crowdsignal Polls & Ratings: version: 3.0.10, author: Automattic, Inc., Auto-updates disabled
Custom Sidebars: version: 3.36, author: WebFactory Ltd, Auto-updates disabled
Disable AMP to AMP Linking.: version: 1.0, author: AMP Support, Auto-updates disabled
Easy Table of Contents: version: 2.0.40, author: Magazine3, Auto-updates disabled
Gravity Forms: version: 2.6.7, author: Gravity Forms, Auto-updates disabled
Gutenberg: version: 14.8.0, author: Gutenberg Team, Auto-updates disabled
IndexNow: version: 1.0.1, author: Microsoft Bing, Auto-updates disabled
Instant Articles for WP: version: 5.0.2, author: Automattic, Dekode, Facebook, Auto-updates disabled
Instant Images: version: 5.0, author: Darren Cooney, Auto-updates disabled
Jetpack: version: 11.6, author: Automattic, Auto-updates disabled
Jetpack Boost: version: 1.6.0, author: Automattic - Jetpack Site Speed team, Auto-updates disabled
Layout Grid: version: 1.8.2, author: Automattic, Auto-updates disabled
LiteSpeed Cache: version: 5.3.1, author: LiteSpeed Technologies, Auto-updates disabled
Maktub Theme Functions: version: 1.3.0, author: Estudio Patagon, Auto-updates disabled
Nginx Helper: version: 2.2.2, author: rtCamp, Auto-updates disabled
oEmbed Infogram: version: 1.1.3, author: android.com.pl, Auto-updates disabled
Page Optimize: version: 0.5.2, author: Automattic, Auto-updates disabled
Performance Lab: version: 1.8.0, author: WordPress Performance Team, Auto-updates disabled
Popup Builder: version: 4.1.14, author: Sygnoos, Auto-updates disabled
Rank Math SEO: version: 1.0.104.1, author: Rank Math, Auto-updates disabled
Redirection: version: 5.3.6, author: John Godley, Auto-updates disabled
SEOPress: version: 6.2.0.2, author: The SEO Guys at SEOPress, Auto-updates disabled
Site Kit by Google: version: 1.90.0, author: Google, Auto-updates disabled
tagDiv Cloud Library: version: 2.3 | built on 05.10.2022 13:12, author: tagDiv, Auto-updates disabled
tagDiv Composer: version: 3.4 | built on 05.10.2022 13:12, author: tagDiv, Auto-updates disabled
tagDiv Mobile Theme: version: 2.1 | built on 05.10.2022 13:12, author: tagDiv, Auto-updates disabled
tagDiv Social Counter: version: 5 | built on 11.04.2022 7:46, author: tagDiv, Auto-updates disabled
User Role Editor: version: 4.63.2, author: Vladimir Garagulya, Auto-updates disabled
User Switching: version: 1.7.0, author: John Blackbourn & contributors, Auto-updates disabled
Veen Theme Functions: version: 2.5.2, author: Estudio Patagon, Auto-updates disabled
W3 Total Cache: version: 2.2.9, author: BoldGrid, Auto-updates disabled
Web Stories: version: 1.28.1, author: Google, Auto-updates disabled
WooCommerce Amazon Pay: version: 2.3.0, author: WooCommerce, Auto-updates disabled
WooCommerce Payments: version: 5.2.0, author: Automattic, Auto-updates disabled
WooCommerce Shipping & Tax: version: 2.1.0, author: WooCommerce, Auto-updates disabled
WordPress.com Editing Toolkit: version: 3.51525, author: Automattic, Auto-updates disabled
WordPress Importer: version: 0.8, author: wordpressdotorg, Auto-updates disabled
WP-Sweep: version: 1.1.5, author: Lester 'GaMerZ' Chan, Auto-updates disabled
WP Downgrade | Specific Core Version: version: 1.2.5, author: Reisetiger, Auto-updates disabled
WP Reset: version: 1.96, author: WebFactory Ltd, Auto-updates disabled
WP Rollback: version: 1.7.2, author: GiveWP.com, Auto-updates disabled
WP Super Cache: version: 1.9.2, author: Automattic, Auto-updates disabled
Yoast SEO: version: 19.13, author: Team Yoast, Auto-updates disabled

### wp-media ###

image_editor: WP_Image_Editor_GD
imagick_module_version: 1691
imagemagick_version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
imagick_version: @PACKAGE_VERSION@
file_uploads: File uploads is turned off
post_max_size: 100M
upload_max_filesize: 100M
max_effective_size: 100 MB
max_file_uploads: 20
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, BMP
ghostscript_version: not available

### wp-server ###

server_architecture: Linux 5.4.0-96-generic x86_64
httpd_software: nginx/1.21.4
php_version: 8.0.21 64bit
php_sapi: fpm-fcgi
max_input_variables: 1000
time_limit: 300
memory_limit: 128M
admin_memory_limit: 256M
max_input_time: 60
upload_max_filesize: 100M
php_post_max_size: 100M
curl_version: 7.74.0 OpenSSL/1.1.1n
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: true

### wp-database ###

extension: mysqli
server_version: 10.5.4-MariaDB-1:10.5.4+maria~focal
client_version: mysqlnd 8.0.21
max_allowed_packet: 16777216
max_connections: 151

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/htdocs/current/wp-content
WP_PLUGIN_DIR: /var/www/htdocs/current/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: true
WP_DEBUG_DISPLAY: false
WP_DEBUG_LOG: true
SCRIPT_DEBUG: true
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: Undefined
DB_CHARSET: utf8mb4
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

### amp_wp ###

amp_slug_query_var: amp
amp_slug_defined_late: false
amp_mode_enabled: standard
amp_reader_theme: legacy
amp_templates_enabled: post, page, product, is_singular, is_front_page, is_home, is_archive, is_author, is_date, is_search, is_404, is_category, is_tag, is_tax[product_cat], is_tax[product_tag], is_tax[product_shipping_class], is_post_type_archive[product]
amp_serve_all_templates: true
amp_css_transient_caching_disabled: false
amp_css_transient_caching_threshold: 5000 transients per day
amp_css_transient_caching_sampling_range: 14 days
amp_css_transient_caching_transient_count: 224
amp_css_transient_caching_time_series: 
	20221220: 0
	20221221: 206
amp_libxml_version: 2.9.10

Gutenberg Version

No response

OS(s) Affected

All

Browser(s) Affected

All

Device(s) Affected

All

Acceptance Criteria

No response

Implementation Brief

No response

QA Testing Instructions

No response

Demo

No response

Changelog Entry

No response

@milindmore22 milindmore22 added the Bug Something isn't working label Dec 22, 2022
@westonruter westonruter added this to the v2.3.1 milestone Jan 10, 2023
@westonruter westonruter added this to Backlog in Ongoing via automation Jan 10, 2023
@westonruter westonruter moved this from Backlog to To Do in Ongoing Jan 10, 2023
@westonruter
Copy link
Member

@milindmore22 If you could use a development build of the plugin to obtain the error stack trace, you'd be able to see the error without the minified identifiers.

@milindmore22
Copy link
Collaborator Author

Error stack trace from dev build

{
  "message": "Cannot read properties of null (reading 'type')",
  "stack": "TypeError: Cannot read properties of null (reading 'type')\n    at getSourcesFromScannableUrls (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:22031:20)\n    at https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:22368:112\n    at updateMemo (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:69580:19)\n    at Object.useMemo (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:70126:16)\n    at useMemo (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:81765:21)\n    at SiteScanContextProvider (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:22358:66)\n    at renderWithHooks (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:68698:18)\n    at updateFunctionComponent (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:71069:20)\n    at beginWork (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:72776:16)\n    at HTMLUnknownElement.callCallback (https://amp-support.rt.gw/wp-content/plugins/amp/assets/js/amp-settings.js?ver=fae98ce24e12e591e3f8:57658:14)"
}

@thelovekesh
Copy link
Collaborator

We are getting some null sources in validation errors which are requested on-site scans.

image

and while checking the source type in the below lines it gives the error.

for (const source of validationError.sources) {
if (source.type === 'plugin') {

The below condition checks if sources are not empty, but there should be a guard as well to check if a source is not null.

if (!validationError?.sources?.length) {
continue;
}

@milindmore22
Copy link
Collaborator Author

Tested prod build for PR #7406 it seems to have fixed the issue.
Tested with WC version 7.2.0, 7.2.1, 7.2.2, 7.2.3

@westonruter westonruter moved this from To Do to Ready for QA in Ongoing Jan 11, 2023
@westonruter westonruter modified the milestones: v2.3.1, v2.4 Jan 26, 2023
@pavanpatil1
Copy link

QA Passed ✅

Cross-checked the issue and the fix is working fine. After scanning the site with WooCommerce plugin and TwentyTwentytwo theme the AMP settings page was showing the error that is fixed and working as expected.

Before:
image

After Fix:

settingpage.mp4

@thelovekesh thelovekesh moved this from Ready for QA to QA Passed in Ongoing Feb 6, 2023
@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Changelogged Whether the issue/PR has been added to release notes.
Projects
Ongoing
  
QA Passed
4 participants