We are attempting to automate the sync of DAM assets in our Drupal environment using the following command in a cron task:
queue-run media_acquiadam_asset_refresh
As suggested in the following document:
https://www.drupal.org/docs/8/modules/media-acquia-dam/asset-sync-config →
...
None of the assets update and we receive hundreds of the following error messages:
Client error: GET https://apiv2.webdamdb.com/assets/64447515 resulted in a 404 Not Found response:
{"message":"Not Authorized"}
Checking in the DAM for the id numbers in the errors we verified that the assets had been removed by user action.
It appears that when the sync operation cannot find an asset in the DAM to sync with, it leaves the queue entry intact and adds new entries on later cron runs, bloating the queue and throwing more errors.
Quick steps to reproduce:
- Set up the Media AcquaDAM module ecosystem, entity browsers, content types, etc.
- Add assets to DAM and complete the required metadata
- Insert a DAM asset into a Drupal content entity
- Delete the DAM asset
- Run cron and the sync task; observe errors as shown above
Expected outcome: Asset sync queue is cleared and available assets are synced - missing assets are either ignored or deleted from Drupal
Actual outcome: Errors thrown & logged, asset sync queue items retained, missing assets remain in place and new queue items created
I would propose the following when a DAM asset is determined to be missing: The local item is flagged for removal, either deletion (which seems bad, leading to broken images) or is no longer added to the queue (and is allowed to exist as an orphaned asset); A user config could determine the action to take.