Drupal AMP Throwing a 500 Error with the ?amp on the URL

I encountered an issue attempting to setup a Drupal site with AMP, when adding the ?amp to the end of the URL I would simply hit a 500 error in the browser. Interestingly enough the clean URL validated on Google's AMP Test.

What I Tried

  • Tested with several available versions of the AMP Library
  • Tested in multiple versions of Drupal
  • Tested in various server environments with slightly different versions of PHP

Solution

In the end I loaded a fresh copy of Drupal and AMP 7.x-1.0
As it turns out I had checked "Power User: Run the whole HTML page through the AMP library" on all of my test sites and this is what caused the ?amp to throw a 500 error. Once I un-checked this the problem went away.

One Slight Issue...

I noticed the [Test that AMP is configured properly] button still throws a 500 error. I opened an issue on the Drupal forums to see if anyone has any ideas on what might still be causing this.

500 error