• Resolved kerm131

    (@kerm131)


    Hello!

    I use Authentic theme on my website. To create AMP pages I’ve installed AMP plugin, but I can’t solve the issue that I faced with. When I choose Standart or Transitional mode, I get the error:

    “URL validation failed due to the AMP validation request not returning JSON data. This may be due to a PHP fatal error occurring. Please check your server PHP error logs; to do this you may need to enable WP_DEBUG_LOG.”

    Unfortunately, there are no errors in the error log. At the front end I the this: https://prnt.sc/sd4rum When I click “Review 40 validation errors” I forwarded to the empty page: https://prnt.sc/sd4ssm

    And for this moment I stucked with this issue.

    Site Heath: Good

    Active plugins:
    Absolute Reviews
    Advanced Popups
    AMP
    Canvas
    Contact Form 7
    Kirki Customizer Framework
    Loco Translate
    One Click Demo Import
    Powerkit
    Regenerate Thumbnails
    SearchWP Live Ajax Search
    VDZ Yandex Metrika Plugin
    Yoast SEO

    I’ve tried to enable/disable all of them, but there is no difference(

    Please, help me to find a solution.

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • @kerm131 It looks like you’re using an alternative AMP plugin. You’ll need to submit your support topic to the correct support forum.

    Thread Starter kerm131

    (@kerm131)

    @jamesosborne sorry, the mentioned plugin is turned off. AMP works again

    @kerm131 As you’re using the plugin in standard mode all those validation errors are handled by the plugin. Can you share your full Site Health information and we can investigate the notice you’ve been encountering?

    Thread Starter kerm131

    (@kerm131)

    @jamesosborne

    
    ### wp-core ###
    
    version: 5.4.1
    site_language: ru_RU
    user_language: ru_RU
    timezone: +03:00
    permalink: /%category%/%postname%/
    https_status: true
    user_registration: 0
    default_comment_status: open
    multisite: false
    user_count: 1
    dotorg_communication: true
    
    ### wp-paths-sizes ###
    
    wordpress_path: /home/prodaite/bkb.by
    wordpress_size: 45,79 MB (48014452 bytes)
    uploads_path: /home/prodaite/bkb.by/wp-content/uploads
    uploads_size: 27,98 MB (29335626 bytes)
    themes_path: /home/prodaite/bkb.by/wp-content/themes
    themes_size: 8,58 MB (9001653 bytes)
    plugins_path: /home/prodaite/bkb.by/wp-content/plugins
    plugins_size: 40,11 MB (42058415 bytes)
    database_size: 7,13 MB (7479416 bytes)
    total_size: 129,59 MB (135889562 bytes)
    
    ### wp-active-theme ###
    
    name: Authentic (authentic)
    version: 6.1.2
    author: Code Supply Co.
    author_website: https://codesupply.co
    parent_theme: none
    theme_features: editor-style, post-thumbnails, align-wide, title-tag, html5, automatic-feed-links, responsive-embeds, post-formats, canvas-disable-section-responsive, powerkit-post-format-ui, powerkit-post-featured-ui, jetpack-responsive-videos, amp, widgets, menus
    theme_path: /home/prodaite/bkb.by/wp-content/themes/authentic
    
    ### wp-themes-inactive (3) ###
    
    Twenty Nineteen: version: 1.5, author: Команда WordPress
    Twenty Seventeen: version: 2.3, author: Команда WordPress
    Twenty Twenty: version: 1.2, author: Команда WordPress
    
    ### wp-plugins-active (13) ###
    
    Absolute Reviews: version: 1.0.4, author: Code Supply Co.
    Advanced Popups: version: 1.0.3, author: Code Supply Co.
    AMP: version: 1.5.3, author: AMP Project Contributors
    Canvas: version: 2.0.2.2, author: Code Supply Co.
    Contact Form 7: version: 5.1.7, author: Takayuki Miyoshi
    Kirki Customizer Framework: version: 3.1.2, author: David Vongries
    Loco Translate: version: 2.3.3, author: Tim Whitlock
    One Click Demo Import: version: 2.5.2, author: ProteusThemes
    Powerkit: version: 2.1.3.1, author: Code Supply Co.
    Regenerate Thumbnails: version: 3.1.3, author: Alex Mills (Viper007Bond)
    SearchWP Live Ajax Search: version: 1.4.6.1, author: SearchWP, LLC
    VDZ Yandex Metrika Plugin: version: 1.4.5, author: VadimZ
    Yoast SEO: version: 14.0.4, author: Team Yoast
    
    ### wp-plugins-inactive (2) ###
    
    Accelerated Mobile Pages: version: 1.0.47, author: Ahmed Kaludi, Mohammed Kaludi
    Autoptimize: version: 2.7.1, author: Frank Goossens (futtta)
    
    ### wp-media ###
    
    image_editor: WP_Image_Editor_GD
    imagick_module_version: Не доступно
    imagemagick_version: Не доступно
    gd_version: 2.2.5
    ghostscript_version: 9.25
    
    ### wp-server ###
    
    server_architecture: Linux 3.10.0-962.3.2.lve1.5.28.el7.x86_64 x86_64
    httpd_software: LiteSpeed
    php_version: 7.4.5 64bit
    php_sapi: litespeed
    max_input_variables: 1000
    time_limit: 30
    memory_limit: 512M
    max_input_time: -1
    upload_max_size: 200M
    php_post_max_size: 64M
    curl_version: 7.62.0 OpenSSL/1.0.2k
    suhosin: false
    imagick_availability: false
    htaccess_extra_rules: true
    
    ### wp-database ###
    
    extension: mysqli
    server_version: 10.1.44-MariaDB-cll-lve
    client_version: mysqlnd 7.4.5
    
    ### wp-constants ###
    
    WP_HOME: undefined
    WP_SITEURL: undefined
    WP_CONTENT_DIR: /home/prodaite/bkb.by/wp-content
    WP_PLUGIN_DIR: /home/prodaite/bkb.by/wp-content/plugins
    WP_MAX_MEMORY_LIMIT: 512M
    WP_DEBUG: false
    WP_DEBUG_DISPLAY: true
    WP_DEBUG_LOG: false
    SCRIPT_DEBUG: false
    WP_CACHE: false
    CONCATENATE_SCRIPTS: undefined
    COMPRESS_SCRIPTS: undefined
    COMPRESS_CSS: undefined
    WP_LOCAL_DEV: undefined
    DB_CHARSET: utf8
    DB_COLLATE: undefined
    
    ### wp-filesystem ###
    
    wordpress: writable
    wp-content: writable
    uploads: writable
    plugins: writable
    themes: writable
    
    ### amp_wp ###
    
    amp_mode_enabled: standard
    amp_templates_enabled: post, page, attachment, is_singular, is_front_page, is_home, is_archive, is_author, is_date, is_search, is_404, is_category, is_tag
    amp_serve_all_templates: true
    amp_css_transient_caching_disabled: false
    amp_css_transient_caching_threshold: 5000 transients per day
    amp_css_transient_caching_sampling_range: 14 days
    amp_css_transient_caching_transient_count: 134
    amp_css_transient_caching_time_series: 
    	20200508: 134
    
    
    Plugin Author Weston Ruter

    (@westonruter)

    Humm. In the past I saw this happen when a site had a plugin that tried injecting an HTML comment at the end of the response, and this caused the JSON to break.

    That doesn’t seem to be the case here, however.

    I have a debugging plugin for you which should help identify where the failure is.

    Please install this extension plugin: https://gist.github.com/westonruter/48e546e4636bec5fafd8a29e0fc7a001

    Once you activate, you’ll see two new menu items under the AMP admin bar menu item:

    1. Debug AMP validation response directly
    2. Debug AMP validation response w/ loopback request

    When clicking either of those and things are working properly, you should see valid JSON data being returned in both cases.

    I suspect the loopback request check (2) is going fail with the response_not_json issue. The direct request (1) should then reveal what exactly is in the JSON that is causing the problem.

    Thread Starter kerm131

    (@kerm131)

    @westonruter Hello! Just installed plugin. Results:

    [2] Debug AMP validation response w/ loopback request
    {
    “success”: false,
    “results”: {
    “errors”: {
    “response_not_json”: [
    “”
    ]
    },
    “error_data”: []
    }
    }

    [1] Debug AMP validation response directly

    Errors: https://bkb.by/lombardy/kak-poluchit-bolee-vygodnyj-kredit-v-lombarde/?amp&amp_validate=1ce27565c666f968b3dda0e5d063310b

    Plugin Author Weston Ruter

    (@westonruter)

    @kerm131 please copy to the output of the second one into a Gist, for example. And then share the URL to the Gist.

    Thread Starter kerm131

    (@kerm131)

    Plugin Author Weston Ruter

    (@westonruter)

    @kerm131 Interesting. I don’t actually see any JSON validation error. I’m able to pass that into json_decode() locally in PHP and it parses fine.

    The code in question that is failing in the plugin is this:

    if ( '{' !== substr( $response, 0, 1 ) ) {
    	return new WP_Error( 'response_not_json' );
    }

    So the first byte in the response is not { somehow. If I try getting the contents of the non-AMP page and pass it into a hex viewer like so:

    curl -s https://bkb.by/lombardy/kak-poluchit-bolee-vygodnyj-kredit-v-lombarde/ | xxd | head -n 3

    The first three lines I get back are the following:

    00000000: efbb bf3c 2144 4f43 5459 5045 2068 746d  ...<!DOCTYPE htm
    00000010: 6c3e 3c68 746d 6c20 6c61 6e67 3d22 7275  l><html lang="ru
    00000020: 2d52 5522 3e3c 6865 6164 3e3c 6d65 7461  -RU"><head><meta

    Notice the three dots before the doctype. The three dots correspond to these bytes: 0xEF, 0xBB, 0xBF. These are the infamous UTF-8 byte order mark (BOM). It seems the issue is that one of your PHP files was saved with this character and the result is it getting added to the beginning of the response, which is then breaking the JSON parsing.

    Two things to do here:

    1) On your side, try to identify what is causing that BOM character to be added.
    2) On our side, we’ll make it so that this character is stripped out.

    Plugin Author Weston Ruter

    (@westonruter)

    I’ve filed an issue in the AMP plugin to address this: https://github.com/ampproject/amp-wp/issues/4678

    I’ve also opened a pull request with a fix, including a test build you can use: https://github.com/ampproject/amp-wp/pull/4679#issuecomment-626375292

    Nevertheless, you should still remove the BOM from your site as it can cause WordPress to be unable to send the HTTP response headers.

    Thread Starter kerm131

    (@kerm131)

    @westonruter thank you for your help! The problem was in BOM. When I fixed, the plugin start work correctly without mistakes.

    Plugin Author Weston Ruter

    (@westonruter)

    Excellent. We’d appreciate a plugin review!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘URL validation failed error’ is closed to new replies.