Media won't sync using the wordpress plugin

mbouclas
mbouclas Member Posts: 1
edited April 2024 in Developer APIs

Media are stuck on uploading to cloudinary status. Using the CLI `wp cloudinary sync` or performing a manual sync using the internal api $sync->managers['push']->process_assets( $asset ); works fine. I can't download the report cause i get an error

Fatal error: Uncaught Error: Call to a member function get_public_id() on null
in /var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-storage.php on line 395

No errors pop in the logs, the installation is fresh, using docker and the same setup works on other websites i have using the exact same docker image and plugin version.

The cloudinary version is 3.1.8, Wordpress is at 6.4.3 and PHP is at 8.2.17

Edit

Upon doing some digging, at least the report error, is caused by missing plugin instance in the class-storage file. Adding the following in the constructor solved the problem

$this->media = $plugin->get_component('media');
$this->sync = $plugin->get_component('sync');

Of course that should not be the case so something causes bad class instantiation, which is probably why the sync is not working

Tagged:

Answers