Fatal Error: Interface ‘AmpProject\Optimizer\Transformer’ not found

Error messages:

Fatal error: Interface ‘AmpProject\Optimizer\Transformer’ not found in app/code/Plumrocket/AmpComponent/Model/RemoveUnusedExtensionsTransformer.php.

or

Exception (ReflectionException): Class AmpProject\Optimizer\ErrorCollectionFactory does not exist

Issue Description

Most likely, you are experiencing this fatal error after installing the AMP extension via FTP and running bin/magento setup:di:compile.

However, running this command is not enough to complete the installation. Please make sure to follow our AMP Installation or Upgrading guide so that you don’t miss any required steps. 

In this case, you probably missed installing the AMP Toolbox, which is a crucial and required tool for the AMP extension to work properly. It helps increase Core Web Vitals score on AMP pages and convert CMS content to AMP HTML format.

Solution

It is likely that you have not installed all the composer packages, so follow the next steps to fix it.

Step 1

Run the following command to install the required composer AMP Toolbox for PHP and Google reCAPTCHA packages:

composer require ampproject/amp-toolbox ^0.6
composer require google/recaptcha ^1.2

Step 2 (optional)

We also recommend you to install the WebP Convert composer package for the built-in support of WebP:

composer require rosell-dk/webp-convert

Was this article helpful?