Skip Navigation

[Closed] AMP validation errors due to div tag and script added before !doctype HTML

This support ticket is created 2 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.75 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 18 replies, has 2 voices.

Last updated by Luo Yang 2 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2139557

I have had the AMP for WP plugin active on a number of different sites and lately I started seeing validation errors on the following website:

hidden link

I reported the problem to AMP for WP support and they found that there's a div tag and a script that appear before anything else on the problematic pages.

The homepage is one of the pages where you can see the problem.

As Toolset appears in the script, I assumed the problem had to do with one of the Toolset plugins so I deactivated Toolset Blocks first, cleared the cache, reloaded the AMP version, and checked the source and the div and script were no longer there.

Please advise.

Thanks

#2139883
js-error-4.JPG

Hello,

I have checked the URL you mentioned above, but don't see the same problem as you mentioned above:

there's a div tag and a script that appear before anything else on the problematic pages.

But I see some JS errors from your theme files, see my screenshot js-error-4.JPG

Is there any missing steps?

#2140403

Sorry, Luo

I didn't include the problematic AMP URL.

Here's where you can see the issue:

hidden link

#2140753

Thanks for the details, the problem is abnormal, please check these:
1) In case it is a compatibility problem, please deactivate all other plugins, and switch to WordPress default theme 2021, deactivate all custom PHP/JS code snippets, and test again

2) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

3) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2142799

Hi Luo

I deactivated all plugins except AMP for WP and switched to the 2021 theme.

In the source code, the HTML appeared as it should.

In the Console, I saw the following error:

vendors.js:2609 You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (hidden link) for browserify or setting mode to production in webpack (hidden link) to ensure you have the correct code for your production build.

When I activated Toolset Blocks (no other plugins other then AMP for WP and still with the 2021 theme), I checked out the source code and found the error that I have reported.

In the Console, I saw that there were now 4 errors:

(index):1 Uncaught ReferenceError: toolsetCommonEs is not defined
at (index):1
(index):1 Uncaught ReferenceError: toolsetCommonEs is not defined
at (index):1
vendors.js:2609 You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (hidden link) for browserify or setting mode to production in webpack (hidden link) to ensure you have the correct code for your production build.
Error handling response: TypeError: Cannot read property 'value' of null
at eval (webpack-hidden link)

As an alternative to the duplicator package, can I just give you access to the staging environment?

#2143485

Please try to clean your website file "wp-config.php" settings, see the solution of similar thread here:
https://toolset.com/forums/topic/uncaught-referenceerror-toolsetcommones-is-not-defined/#post-1867549

#2146855

I don't know what "cleaning" a wp-config.php file settings means - the similar solutions did nothing.

Anyway, the plugin developer has a plugin that allows users to disable plugins so I used it to disable Toolset Blocks and the AMP version is once again indexed.

#2147219

Please a copy of your website in below private message box, also point out the problem page URLs, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2154449

Unfortunately Duplicator times out ("blames" WP Engine settings). Tried their alternative method but it doesn't make any progress.

Would you be able to work with the staging environment?

#2155045

Please provide your website credentials and FTP/SFTP access in below private message box, also point out the problem page URLs, thanks

#2157945

I have tried the SFTP access you provide above, it is not valid, I get below error message:

Error: Connection timed out after 20 seconds of inactivity
Error: Could not connect to server

Please check it, make sure it is valid SFTP access, and I have enabled the private message box, in case you need provide other access information

#2158557

Hi Luo

I just logged in using the credentials provided.

One field that wasn't required on the form is the port, so maybe that's the issue?

Anyway the port is 2222.

#2159151

Thanks for the details, I have done below modifications in your website:
Edit the file wp-config.php, added two lines in line 27:

/** 

and line 70:

**/

It should be able to comment out those extra settings from other plugins,

Test it in frontend, it works fine now:
hidden link

Can you confirm it?

#2160295

The staging site - with those lines commented out - doesn't work, probably because most of the lines are WP engine settings.

The frontend website that you've referenced works fine now because I disabled the Toolset plugin on AMP using AMP for WP's plugin manager.

#2161741

I have tried the credentials you provided above, The staging website you provided above is not valid, I get below error message:
totallomstg.wpengine.com is currently unable to handle this request.
HTTP ERROR 500

Did you do any change? Can you restore it back?

And I have tried to get the PHP debug logs from your staging website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/#php-debugging

Your website does not create any PHP debug log file "error_log.txt", you might need to get the PHP debug logs from your webserver providers.

The topic ‘[Closed] AMP validation errors due to div tag and script added before !doctype HTML’ is closed to new replies.