Support » Plugin: AMP » Validation error… in the line calling for amp-anim … .js

  • Resolved Sabinooo

    (@sabinooo)


    Hello!

    My blog fails AMP validation, however I fail to understand what might be wrong, because it seems this is with the basic calls for AMP’s elements that there is an issue.

    can I ask you for your help please ? I cannot share the URL of the blog: this is a private place, I apologize for that.

    The same error messages were found with both this validator: http://technicalseo.com/seo-tools/amp/ and the Chrome console.
    I have installed AMP just an hour ago, version 0.3.2.

    (1)
    « The attribute ‘src’ in tag ‘amp-anim extension .js script’ is set to the invalid value ‘//cdn.ampproject.org/v0/amp-anim-0.1.js’. »
    … And that line in the code only contains:
    <script custom-element="amp-anim" src="//cdn.ampproject.org/v0/amp-anim-0.1.js" async></script>

    (2)
    « The tag ‘script’ is disallowed except in specific forms. »
    In that line, there was:
    <script custom-element="amp-analytics" src="//cdn.ampproject.org/v0/amp-analytics-0.1.js" async></script>

    (3)
    « The mandatory tag ‘amphtml engine v0.js script’ is missing or incorrect. »
    and
    (4)
    « The tag ‘amp-anim extension .js script’ is missing or incorrect, but required by ‘amp-anim’. »
    are both for the final line of the page, line 310.
    The end of the page is made of text relevant to my wp-supercache plugin, lines 308-309-310:

    <!-- Dynamic page generated in 0.394 seconds. -->
    <!-- Page not cached by WP Super Cache. Check your settings page. Not caching requests by known users. (See Advanced Settings page) -->
    <!-- Super Cache dynamic page detected but $wp_super_cache_late_init not set. See the readme.txt for further details. -->

    I’m not too sure as to what may need to be fixed, honestly.
    Please bear with a newbie, if you can, thank you 🙂

    https://wordpress.org/plugins/amp/

Viewing 8 replies - 1 through 8 (of 8 total)
  • To be sure, I re-did the test with wp-supercache excluding all /amp/ strings.

    I had the same errors in the beginning, but not in the end.

    The attribute ‘src’ in tag ‘amp-anim extension .js script’ is set to the invalid value ‘//cdn.ampproject.org/v0/amp-anim-0.1.js’.
    for
    <script custom-element="amp-anim" src="//cdn.ampproject.org/v0/amp-anim-0.1.js" async></script>
    The tag ‘script’ is disallowed except in specific forms.
    for
    <script src="//cdn.ampproject.org/v0.js" async></script>
    – and in the end, two errors for the same final page line:
    The mandatory tag ‘amphtml engine v0.js script’ is missing or incorrect. , and
    The tag ‘amp-anim extension .js script’ is missing or incorrect, but required by ‘amp-anim’.
    for (I also give the two lines before it just in case)

    </div>
    </body>
    </html>

    I’m trying to figure it out with documentation why things may be wrong, but so far, I’m afraid, I just don’t manage to figure it out…

    HAAAAA!

    I found how it *might* work!

    I used this tool, that allows to fetch a page, and then live-edit its HTML, and then see if that would be a page that would pass the validation test:
    http://tools.maxxeight.com/amp-html/

    I also read this doc:
    https://www.ampproject.org/docs/reference/extended/amp-anim.html

    And the code *would* work, apparently, if I added https!

    Basically, it would require to replace

    <script custom-element="amp-anim" src="//cdn.ampproject.org/v0/amp-anim-0.1.js" async></script>
    <script src="//cdn.ampproject.org/v0.js" async></script>

    With

    <script custom-element="amp-anim" src="https://cdn.ampproject.org/v0/amp-anim-0.1.js" async></script>
    <script src="https://cdn.ampproject.org/v0.js" async></script>

    Would someone know how to make the Amp plugin do that, please ?

    I hope you won’t mind me making the whole conversation, I’m not trying to bump my thread, simply mentioning it when I advance in my thought process.

    I found that the plugin, in its source code, has this part: in
    includes\sanitizers\class-amp-img-sanitizer.php
    there is
    private static $script_src = 'https://cdn.ampproject.org/v0/amp-anim-0.1.js';

    So… this is weird, no ? This DOES call for the https version… then, why is there a non-https call in the public /amp/ page ?!?

    Well, I’m closing my own discussion 😀

    I searched around and around, and I finally found the problem: Cloudflare.

    For, yes, my website is behind Cloudflare Pro, and I had no idea it might cause an issue. Well, it did.

    At the moment, the way they work isn’t compatible at all with AMP.
    Their engineers are discussing with Google’s engineer, but there is no known date when things will work out yet.

    Case closed, for now. See your later, AMP 🙂

    Robert

    (@kinderrwindstreamnet)

    I had the same problem. Disabling the CloudFlare plugin solved it.

    Initially I was getting validation errors on the AMP scripts included by the Automattic plugin, example:

    “The attribute ‘src’ in tag ‘amp-iframe extension .js script’ is set to the invalid value ‘//cdn.ampproject.org/v0/amp-iframe-0.1.js’.”

    because the following scripts had protocol relative URLs lacking http: or https: as follows:

    <script custom-element=”amp-iframe” src=”//cdn.ampproject.org/v0/amp-iframe-0.1.js” async></script>
    <script custom-element=”amp-analytics” src=”//cdn.ampproject.org/v0/amp-analytics-0.1.js” async></script>
    <script src=”//cdn.ampproject.org/v0.js” async></script>

    Turning off the CloudFlare plugin protocol rewriting option didn’t work. Disabling the plugin worked! Now the URLs are:

    <script custom-element=”amp-iframe” src=”https://cdn.ampproject.org/v0/amp-iframe-0.1.js” async></script>
    <script custom-element=”amp-analytics” src=”https://cdn.ampproject.org/v0/amp-analytics-0.1.js” async></script>
    <script src=”https://cdn.ampproject.org/v0.js” async></script>

    which resolves the validation errors. BTW my site is full SSL/HTTPS.

    Hey, are you guys using the Cloudflare plugin? The last option on its settings page is for “HTTPS protocol rewriting” which converts http:// AND https:// references to just // on the fly — Disabling that setting fixed these changes for me and allowed me to keep both Cloudflare and AMP.

    Robert

    (@kinderrwindstreamnet)

    I’m using the CloudFlare plugin. Correction to my original statement, disabling HTTPS protocol rewriting and/or disabling the plugin didn’t work.

    I opened a ticket with CloudFlare Support who said to create a Page Rule and turn off all CloudFlare options.

    The AMP Page Rule on my CloudFlare account is:

    http://www.mysite.com/*/amp/*
    with the following rules:
    ByPass Cache
    Apps (All CloudFlare Apps) – Off
    Performance (Auto Minify and Polish) – Off
    Mirage 2 – Off
    Railgun – Off
    Security – Off
    SSL – Full SSL (Strict) (note: my site is full SSL/HTTPS)
    Security Level – Default
    Browser Integrity Check – Default

    The above Page Rule with the CloudFlare plugin enabled and HTTPS Protocol Rewriting turned Off is working fine with no AMP validation errors in Google Search Console.

    I suspect that Minify and Polish could be enabled but haven’t experimented.

    See Cloudflare (and maybe other) CDN breaking AMP pages #2380 discussion on GitHub with some CloudFlare employees.

    Hi

    I am not using Cludflare and nevertheless have this Problem. Unfortunatly I could not find a file to replace http with https. So I would be happy for giving me a hint

    Cheers from Germany

    Hansjörg

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Validation error… in the line calling for amp-anim … .js’ is closed to new replies.