Expand my Community achievements bar.

Question on the AEM Assets upload library

Avatar

Level 3

Hi all

 

I have posted this on the github of the aem-upload library but would appreciate anyone here also can chime on this?

 

https://github.com/adobe/aem-upload/issues/131

5 Replies

Avatar

Level 4

Hi @kartheekd203042

The issue you're encountering with the intermittent 404 error during asset uploads is likely related to timing or synchronization challenges when dynamically creating folders and immediately using them for uploads. This can happen if the folder creation process hasn't fully propagated or completed before the upload begins, even though you're checking for a 200 or 201 response.

 

To address this, I could recommend leveraging the Asset Folder Creator from the ACS Commons package. This tool is specifically designed to help quickly build complex Asset Folder hierarchies in AEM, ensuring that the folders are created efficiently and reliably before any assets are uploaded.

 
  • The Asset Folder Creator allows you to define and create nested folder structures (like /content/dam/tenant/products/hierarchy1/hierarchy2/hierarchy3) in one go, reducing the chances of partial or incomplete folder creation.
  • By using a dedicated tool for folder creation, you can ensure that the folder hierarchy is fully established before initiating the upload process.
  • It’s particularly useful for scenarios where folders need to be created dynamically based on product structures or other hierarchical data.
 

Avatar

Level 1

Thanks @giuseppebag for the quick response.

Do note that this folder creation is happening from an Azure Function being managed by an external team. They are using the REST APIs to do all these operations and using the aem-upload library. I am not sure how ACS can help this use case unless we customize to expose this ACS tool via another custom API? Sorry if I understood it incorrectly but please feel free to chime in.

Avatar

Level 4

hi @KARTHEEKDE2If using the ACS tool isn't feasible, you can consider creating the necessary folder structure via API before executing the aem-upload command. This way, you can ensure that the folder hierarchy is fully established before initiating the upload process.

 

Here's an example of a curl command, which can easily be converted into JavaScript code for integration with the aem-upload process:

 

curl -u admin:admin \
  -F":name=MyFolder" \
  -F"jcr:primaryType=sling:Folder" \
  http://localhost:4502/content/dam/folderName

 

 

 

Avatar

Level 3

Thanks for the response - the folders are created dynamically based on the new products created and they are using a similar command as above.

The aem upoad library recommended seems to have an issue so working with Adobe support on this as of now.

Avatar

Level 4

Please keep us updated whenever you have the chance.