Skip Navigation

[Escalated to 2nd Tier] 404 and PHP errors when using dynamic image

This support ticket is created 2 years, 10 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.

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/Karachi (GMT+05:00)

This topic contains 10 replies, has 2 voices.

Last updated by Waqar 2 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2266889
Screenshot 2022-01-14 154216.jpg

I have a page with an Image block using a dynamic Image Source (Source: Featured Image URL). The page is very slow to load, and I found multiple 404 errors in my browser Inspector > Network (and sometimes Blocked notice - NS_IMAGELIB_ERROR_LIBRARY) on loading of the following:
hidden link;
(which looks like a shortcode for the dynamic image)

As long as I have the post editor open, the Network log fills with these 404 errors. I also get a slew of errors in my PHP Error Log whenever I edit this page, such as:

Notice: Trying to get property 'post_type' of non-object in /home/site/public_html/wp-content/themes/genesis/lib/classes/class-genesis-script-loader.php on line 376
Context URL: /wp-json/toolset-dynamic-sources/v1/get-source?post_type=rpg-products&post_id=449&_locale=user

Fatal error: Uncaught Error: Class 'OTGS_Installer_Logger_Storage' not found in /home/site/public_html/wp-content/plugins/types/vendor/otgs/installer/includes/functions-core.php:20
Context URL: /wp-json/ToolsetBlocks/Rest/API/v1/MediaObject?_locale=user

Plus several other errors (some are “Cannot allocate memory”) for various other plugins, mostly with Toolset Context URLS, like:

* /wp-json/ToolsetBlocks/Rest/API/v1/MediaObject?_locale=user
* /wp-json/toolset-dynamic-sources/v1/get-source?post_type=rpg-products&post_id=449&_locale=user
* /wp-json/toolset-dynamic-sources/v1/render-source/?source=media-featured-image-data&provider=custom_post_type%7Crpg-products%7C449&post=1748&_locale=user
* /wp-admin/[tb-dynamic%20provider='custom_post_type|rpg-products|449'%20post='current'%20source='media-featured-image-data'%20size='large'%20force-string='first'%20]
* /wp-json/wp/v2/blocks?context=edit&per_page=100&_locale=user

So, it appears that using a dynamic image is triggering all these errors. This same issue occurs whether I have the Views or Blocks plugin enabled. Is there anything I can do on my end to resolve this? Any insight you can provide would be much appreciated (this issue is causing my site to max out server resources!).

Thanks!
Sarah

#2268117

Hi Sarah,

Thank you for contacting us and I'd be happy to assist.

To troubleshoot this, I'll need to see how this post/page is set up in the admin area, which results in these errors.

Can you please share temporary admin login details along with the link to an example post/page edit screen? I'll also need your permission to download the clone/snapshot of your website, in case it needs to be investigated on a different server.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2270067

Thank you for sharing these details and I've downloaded the duplicator package from your website.

This troubleshooting is going to be a bit challenging, but, I'll share my findings as soon as I can.

Thank you for your patience.

#2271813

Thank you for waiting.

During troubleshooting, I was able to reproduce the errors related to the dynamic source on my website too.

When using the Genesis framework/theme, selecting other than the current post/page in the dynamic source settings of the blocks, results in these errors.

I've shared these findings with the concerned team and will keep you updated, through this ticket.

For now, the workaround is to use shortcodes with the "item" attribute to show the images or other content from other posts, instead of using the dynamic source in the blocks.

Related documentation:

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

#2286447

I'd like to update that a fix for this is planned to be included in the upcoming release of Toolset plugins.

For a temporary fix, a patch can be downloaded from:
http://toolset.com/patches/GetSource.php.zip

Here are the steps:

1. Please make sure that all Toolset plugins have been updated to the latest versions.

2. Download the patch zip file and unzip it and it will include the file "GetSource.php".

3. Replace this file with the one at:
/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Rest/GetSource.php

I hope this helps and let me know how it goes.

#2292345

Thank you for looking into this! I'm glad you were able to replicate the issue and work on a fix.

I have installed the patch as you directed, but I am still seeing the same errors (I have cleared both site cache and Cloudflare cache).
The page editor screen takes a while to load, and I am still seeing
404 errors on GET /wp-admin/[tb-dynamic%20provider='__current_post'%20post='current'%20source='media-featured-image-data'%20size='featured-image'%20force-string='first'%20]
and
500 errors on GET hidden link;
and /wp-json/toolset-dynamic-sources/v1/dynamic-sources
(plus some others - the 500 errors may because my site is timing out again due to resource overuse)

#2292557

Thanks for writing back.

The errors showing on your website now are different from the ones showing earlier, due to conflict with the Genesis theme.

There are errors with code 400, which seem to be connected to the JetPack plugin. If you'll go to WP Admin -> Tools -> Site Health -> Status, you'll see two issues reported around the connection with the JetPack and you may have to reconnect it.
( screenshot: hidden link )

The other errors are 522 errors which indicate that the server connection is timing out. You can get in touch with your hosting support team to see if the connection timeout limit can be increased.

#2294805

Hello again! I saw that there was an error related to connecting to Jetpack (I believe it is caused by the site timing out due to the constant 404s). In any case, I have deactivated Jetpack, waited a day (to make sure site resources were not overwhelmed), and opened the post editor for the page with the dynamic images.

I am still getting a steady stream of 404 errors when I have the edit screen open (these are appearing in the browser Inspector Network screen). Same error as I posted originally and in my last post:
404 errors on GET
/wp-admin/[tb-dynamic%20provider='__current_post'%20post='current'%20source='media-featured-image-data'%20size='featured-image'%20force-string='first'%20]

These constant 404 hits on the server while I have the post editor open are what eventually leads to the server timeout errors.

Here are the Toolset errors I got in the PHP Error Log after opening the post editor:
Fatal error: Uncaught Error: Class 'OTGS\Toolset\Views\Controller\Compatibility\EditorBlocks\Blocks' not found in /home/site/public_html/wp-content/plugins/toolset-blocks/application/controllers/compatibility.php:125

Fatal error: Uncaught InvalidArgumentException: The classmap must be an array. in /home/site/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/utility/autoloader.php:89

Warning: include(): Failed opening '/home/site/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/m2m/autoload_classmap.php' for inclusion (include_path='/home/site/public_html/wp-content/plugins/backwpup/vendor/pear/archive_tar:/home/site/public_html/wp-content/plugins/backwpup/vendor/pear/console_getopt:/home/site/public_html/wp-content/plugins/backwpup/vendor/pear/pear-core-minimal/src:/home/site/public_html/wp-content/plugins/backwpup/vendor/pear/pear_exception:.:/opt/alt/php74/usr/share/pear') in /home/site/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/m2m/MainController.php on line 198

#2296213

Thank you for sharing these details.

During further troubleshooting on your website's clone, I noticed that the 404 errors related to the image block's dynamic source are fixed, if the Yoast SEO plugin is deactivated.

Can you please test and confirm the same on your website?

We already have this compatibility issue reported to the concerned team:
https://toolset.com/errata/unexplained-problems-on-backend-edit-screens-possibly-associated-with-json-errors/

#2302823

Yes! I have deactivated the Yoast SEO plugin and can confirm I am no longer seeing the 404 errors on the network screen.

I am still getting some toolset warnings and errors in the PHP Error log when I open the editor for the page, and more errors appear if I leave the page open (eventually, I see a 500 error for wp-json in the network screen). These may be caused by a different issue. Should I start a new ticket?

Fatal error: Uncaught InvalidArgumentException: The classmap must be an array. in /home/site/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/utility/autoloader.php:89

Notice: Trying to get property 'post_content' of non-object in /home/site/public_html/wp-content/plugins/toolset-blocks/backend/Services/ViewParsingService.php on line 310

Thanks for reporting the compatibility issue! I'll keep an eye out for that fix (and it may explain why my other sites with Toolset and Yoast have so many errors too!).

-Sarah

New threads created by Waqar and linked to this one are listed below:

https://toolset.com/forums/topic/split-more-php-errors-showing-in-the-log/

#2304781

Thank you for confirming that and I'll keep you updated with the progress on these two issues, through this ticket.

I've created a separate ticket for the latest errors and notices that you've shared and will follow up on it shortly.
( ref: https://toolset.com/forums/topic/split-more-php-errors-showing-in-the-log/ )