Amp-wp: JS error on settings screen due to _.find not being a function

Created on 1 Aug 2020  路  11Comments  路  Source: ampproject/amp-wp

Bug Description

Can't select Reader mode, either through the Onboarding Wizard or the Settings Screen.

Steps to reproduce

Onboarding Wizard

  1. Go to AMP
  2. Click on AMP configuration wizard
  3. Click next button until the mode selection appears. Choose the Reading mode
  4. See error "The setup wizard has experienced an error.
    _.find is not a function Return to AMP settings."

Screenshots

image

Settings Screen

  1. Go to AMP
  2. Click on Settings
  3. Click on Reader radio button
  4. See error the settings screen disappears and the default mode remains selected - Transitional mode

Screenshots

image

Additional context

  • WordPress version: 袙械褉褋懈褟 5.4.2
  • Plugin version: 2.0.0-beta2

_Do not alter or remove anything below. The following sections will be managed by moderators only._

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

Bug Changelogged Groomed P0 UX

Most helpful comment

@westonruter I don't use Internet Explorer and I don't filtering by amp_reader_themes, but the good news is that it works! The problem is solved! Thanks!

All 11 comments

@PaolaStoyanova Thank you for testing!

Please share your Site Health info with us. You can do so privately via this form: https://forms.gle/PySNjhhxPLrJU6F1A

There appears to be a plugin compatibility issue and the Site Health info will help us to identify it.

Potentially related is this problem we had in Site Kit: https://github.com/google/site-kit-wp/issues/1141#issuecomment-588556520

@PaolaStoyanova would you please test a fix in the build linked here: https://github.com/ampproject/amp-wp/pull/5164#issuecomment-668677729.

@westonruter no problem of course! The problem is the same, only the message is different.

  • development build
    image
  • production build
    image

@PaolaStoyanova Thank you for the update. For some reason the Array#find is not defined. Are you by chance using Internet Explorer?

Given that you're seeing M.find as not being defined here, it could be that minification just by chance resulted in _ being the variable reported when you first reported the issue, and so the problem may not be due to Lodash being incorrectly polyfilled but rather because Array.prototype.find is not defined.

Update: Actually, I see that wp-polyfill.js does actually polyfill Array.prototype.find. So it may indeed by a polyfill problem.

@PaolaStoyanova Are you filtering amp_reader_themes by chance?

I've merged the pull request with what we believe will fix issue.

Please download the latest development build from the develop branch to re-test: https://storage.googleapis.com/ampwp_github_artifacts/refs/heads/develop/dev/amp.zip

If the issue is still not fixed, we'll re-open this issue.

@westonruter I don't use Internet Explorer and I don't filtering by amp_reader_themes, but the good news is that it works! The problem is solved! Thanks!

That is very great to hear! Thank you so much for testing and reporting this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

westonruter picture westonruter  路  3Comments

swissspidy picture swissspidy  路  3Comments

miina picture miina  路  5Comments

luizeof picture luizeof  路  4Comments

GitaStreet picture GitaStreet  路  4Comments