New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined array key "folder" #3
Comments
My bad – this is a problem with my Cloudinary config – not the plugin (tested with alternative cloudinary account and indexing works fine). FYI the difference is something to do with the account's tier... might be good to detect the response to and render something useful to the user for this case? |
Hi @robinbeatty, Could you inform me about the tiers associated with these various accounts and tell me if there was additional information available in the error stack trace? |
Still tracking this down – your plugin seems to behave differently between different accounts on Cloudinary. Here is the trace: `robinbeatty@Robins-Mac-Studio craft % ddev php craft index-assets cloudinary Indexing assets in Cloudinary ... in /var/www/html/vendor/thomasvantuycom/craft-cloudinary/src/fs/CloudinaryFs.php:72 Caused by: PHP Warning 'yii\base\ErrorException' with message 'Undefined array key "folder"' in /var/www/html/vendor/thomasvantuycom/craft-cloudinary/src/fs/CloudinaryFs.php:65 Stack trace: |
I'm curious whether the issue is related to dynamic folder mode. Can you please verify whether the problem is resolved by updating line 65 in 'dirname' => $asset['asset_folder'] ?? $asset['folder'], |
Yes that solves it :) Fantastic. In the meantime I had been comparing the settings of each account and indeed 'Dynamic Folders' is the only setting that's different. |
Alright, great. Don't hesitate to keep sharing bug reports. Despite the care taken, it's likely that more issues will appear with the plugin. |
Ok thanks. ... think there must be another thing regarding this to update in the plugin. Yes the assets will index having updated to example get url |
Is the folder where the asset is stored different from the path segment in the delivery url ( |
Ok, think this is being caused by assets that were previously deleted from cloudinary linging in a cache. After clearing Craft asset index caches, deleting the filesystem and volume and re-adding them I can now index the assets – strangely the assets that get indexed (as displayed in the console feedback) are those of the deleted cloudinary assets, but when I view /admin/assets list view I only see the correct assets as I would expect to see, and the image transform urls are correct, rendering the correct thumbnail. Not sure whether this is a stale cache issue on Cloudinary or Craft. The only unexpected behaviour here is the asset indexing, which appears to index more assets than are present in the cloudinary library. |
Sorry, no actually – this is only now indexing files at 'root level' in Cloudinary. If there are subfolders in Cloudinary, the folders arrive as Craft asset folders, but they do not contain any images. You're welcome to grab a copy of my db and cloudinary account access if it would help track this down – I'm guessing an issue with how assets are mapped to the folders? |
Just to confirm that, having heard back from Cloudinary support, Dynamic Folders is enabled for this account, whereas the other account it's not enabled. |
Having access to your setup and Cloudinary account would be really helpful, since I don't have an account with dynamic folders. I can have a look at it tomorrow. |
The issue has been addressed and incorporated into version 1.3.0, which is now available. As dynamic folders mode is a recent addition to the Cloudinary API, I'm labeling this as an enhancement. |
Thanks for the update. All works as expected – There's one thing I noticed that would be useful – when assets get deleted from the remote source they correctly get removed when craft re-indexes the volume. However, if they were in a subfolder, the subfolders in craft remain (as empty folders). Is there a way of automatically deleting the folders in craft if they don't exist in cloudinary? |
Hey, since upgrade to 1.2.1 assets won't index via
php craft index-assets <volume name>
and throws exception 'Undefined Array Key "folder"' at CloudinaryFs.php:72Pretty sure this was fine in 1.2.0. Could you take a look?
Many thanks!
The text was updated successfully, but these errors were encountered: