AMPBench: AMP URL validation and troubleshooting tools
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
docs New /docs folder. Added walkthrough doc. Oct 28, 2016
public Report UA being used: #13 Apr 11, 2017
readiness-tool version bump to 2.8 Dec 13, 2017
tests fixed all testing Aug 17, 2017
validator Applied fix for urls that contain accented characters to /api routes. Apr 30, 2018
views Additional support for multiple amphtml links in the canonical Mar 9, 2018
.gitignore Validator rollup + fix #10 Oct 9, 2017
AUTHORS Preparation commit for AMP Project GitHub repo. Oct 5, 2016
CONTRIBUTING.md Preparation commit for AMP Project GitHub repo. Oct 5, 2016
LICENSE Preparation commit for AMP Project GitHub repo. Oct 5, 2016
README.md Roll up validator and fix README. Apr 13, 2017
SCREENSHOT.png Updated SCREENSHOT.png for README.md. Apr 13, 2017
SCREENSHOT.tiff Updated SCREENSHOT.png for README.md. Apr 13, 2017
ampbench_handlers.js Additional support for multiple amphtml links in the canonical Mar 9, 2018
ampbench_lib.js Additional support for multiple amphtml links in the canonical Mar 9, 2018
ampbench_lib_sd.js Logo size contradiction #14 Apr 13, 2017
ampbench_main.js Preparation commit for AMP Project GitHub repo. Oct 5, 2016
ampbench_routes.js Applied fix for urls that contain accented characters to /api routes. Apr 30, 2018
app.yaml Report UA being used: #13 Apr 11, 2017
gulpfile.js Fixed the testing Aug 17, 2017
karma.conf.js testing Jul 6, 2017
logo.png Rewiring to use chrome.storage.local Oct 20, 2017
package-lock.json Implement support for new Google Cache URL format. Jan 22, 2018
package.json Implement support for new Google Cache URL format. Jan 22, 2018

README.md

AMPBench: AMP URL Validation and Troubleshooting

Guides

Walkthrough article: Debug AMP pages with AMPBench, an open source app from the AMP Project.

What does it do?

AMPBench is a web application and service that validates AMP URLs + their associated Structured Data.

During AMP URL validation, it builds referable, support-friendly sharable URLs such as the following:

AMPBench in action

License

AMPBench is licensed under the Apache 2.0 LICENSE.

Disclaimer

AMPBench is not an official Google product.

Getting the code and running it

Install Node.js version 4.X on your system. E.g., by downloading or by using a package manager or by using NVM.

Now do the following from a terminal command-line session:

$ git clone https://github.com/ampproject/ampbench.git
$ cd ampbench
$ npm update
$ nodemon
# or:
$ npm start

Also try navigating to these links from your web browser:

Even try this from the command-line:

$ curl http://localhost:8080/version/
$ curl http://localhost:8080/raw?url=https://ampbyexample.com/
$ curl http://localhost:8080/api?url=https://ampbyexample.com/
$ curl http://localhost:8080/api2?url=https://ampbyexample.com/

Requesting an AMPHTML Validator reload from the CDN (https://cdn.ampproject.org/v0/validator.js)

Use the following URL to ask AMPBench to reload the validator code into memory should a different (not only newer; there might have been a rollback) version be available:

../command_force_validator_update

For example:

Or:

$ curl http://localhost:8080/command_force_validator_update

Utilities

AMPBench includes some useful debug utility commands that can in some cases help with troubleshooting, such as when a full validation fails on a URL by returning unexpected server responses.

The /debug... commands attempt to follow fetch requests and display relevant request and response details in a similar spirit to the curl -I [--head]... utility.

Use these as follows in the browser:

and:

Or, with the command-line compatible _cli equivalents, in a terminal session:

$ curl https://ampbench.appspot.com/debug_cli?url=https://ampbyexample.com

and:

$ curl https://ampbench.appspot.com/debug_curl_cli?url=https://ampbyexample.com

The /debug and /debug_cli versions use a smartphone HTTP User Agent. The /debug_curl and /debug_curl_cli variants use the curl (desktop and server-side) User Agent.

The applied User Agent is reported in the output and can be seen in the resulting HTTP request headers as in the following examples.

For /debug...:

{"User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2725.0 Mobile Safari/537.36","host":"ampbyexample.com"}

and for /debug_curl...:

{"User-Agent":"curl/7.43.0","host":"ampbyexample.com"}

Deploying AMPBench to the Cloud

Deploying AMPBench to Google Compute Engine

To deploy AMPBench to the App Engine flexible environment, you need to have a Google Cloud Platform Console project.

Please review the following documentation:

From within the ampbench source root folder, deplyoment to Google Compute Engine, App Engine flexible environment, should be similar to the following sequence.

Run gcloud init:

$ gcloud init

Deploy and run:

$ gcloud app deploy 

Deploying AMPBench to Amazon Web Services (AWS)

AWS Elastic Beanstalk uses highly reliable and scalable services that are available in the AWS Free Usage Tier and supports apps developed in Node.js, such as AMPBench, out-of-the-box.

Please review the following documentation:

Make sure to set up AWS with your account credentials:

The Elastic Beanstalk Command Line Interface (EB CLI) is configured as follows:

From within the ampbench source root folder, deplyoment to AWS Elastic Beanstalk environment should be similar to the following:

$ eb init # only initially or when the configuration changes
$ eb deploy