How to resolve 500 server error when creating a folder in AEM Headless via react frontend after configuring CORS and CSRF?
I'm working on a headless Adobe Experience Manager (AEM) project with React as the frontend. Just added some CORS and CSRF configurations to handle some other errors I have been encountering. Now getting an error when attempting to create a new folder under /content/dam/my-project/tests via a POST request. Using Assets API to create a folder in a specified location. It leads to an error 500 with AEM logging an AssetException indicating failure to create an asset at the specified path. Here's the error snippet in the error.log:
13.02.2024 12:51:16.523 *WARN* [[0:0:0:0:0:0:0:1] [1707828676513] POST /api/assets/my-project/tests/ HTTP/1.1] com.adobe.granite.rest.impl.servlet.PostRequest Exception during request processing.
com.adobe.granite.asset.api.AssetException: Failed to create Asset at path [/content/dam/my-project/tests]
at com.adobe.granite.asset.core.impl.AssetManagerImpl.createAsset(AssetManagerImpl.java:78) [com.adobe.granite.asset.core:2.2.76]
at com.adobe.granite.rest.assets.impl.DefaultAssetPlugin.createAsset(DefaultAssetPlugin.java:98) [com.adobe.granite.rest.assets:1.0.74]
at com.adobe.granite.rest.assets.impl.AssetResourceProvider.create(AssetResourceProvider.java:226) [com.adobe.granite.rest.assets:1.0.74]
Any ideas? Or additional tips to troubleshoot? Currently not much in the error logs apart from a 'failure to create asset' error.
Thanks.
