Troubleshooting Headless Universal Visual Editor integrations
The Universal Visual Editor (UVE) is a powerful tool in dotCMS that enables content creators to visually edit and preview structured content within headless applications. However, developers integrating UVE into their applications may encounter challenges that require careful troubleshooting. This guide outlines common integration issues and provides best practices to resolve them efficiently.
Understanding UVE and Its Integration
Before diving into troubleshooting, it is essential to understand how UVE functions in a headless architecture. UVE interacts with dotCMS’s APIs to retrieve and render content in an inline editing mode. To enable seamless integration, developers must ensure that:
The application properly consumes dotCMS’s headless APIs.
UVE is correctly embedded within the front-end framework.
Content types and permissions in dotCMS are configured correctly.
The local environment is well integrated with UVE, using allowedDevURLs for real-time feedback without blocking content authors.
Common Issues and Solutions
Deployment and Environment Configuration Issues
Possible Causes:
Environment variables (NEXT_PUBLIC_DOTCMS_HOST, NODE_TLS_REJECT_UNAUTHORIZED) not set correctly.
Differences between local, staging, and production configurations leading to inconsistent behavior.
SSL/TLS errors preventing API communication in production.
Troubleshooting Steps:
Validate that all environment variables are properly configured in .env files.
Use different configuration settings for local, staging, and production environments.
Ensure proper SSL certificates are in place and test API connectivity over HTTPS.
1. UVE Not Loading or Displaying Correctly
Possible Causes:
Incorrect API endpoint configuration.
JavaScript errors in the application. Check the server and client (browser) console logs if applicable
CORS policy restrictions.
Troubleshooting Steps:
Check API calls in the browser’s developer console and confirm that responses are returning expected JSON structures.
Ensure that the front end correctly implements UVE’s JavaScript SDK and that all required dependencies are included.
Verify CORS settings in dotCMS to allow requests from the application's domain.
Utilize the dotCMS.log Viewer under Settings > Maintenance > Log Files to check system logs for content rendering or API-related errors.
2. Content Edits Not Saving
Possible Causes:
Authentication issues with API requests.
Missing permissions for the user role.
Webhook or API misconfiguration.
Troubleshooting Steps:
Ensure that API requests include valid authentication tokens and that session cookies are passed correctly.
Confirm that the user has the necessary edit permissions for the content types being modified.
Test API endpoints manually using tools like Postman to verify that content updates are processed successfully.
Utilize the API Playground under Dev Tools to test API requests before deployment.
3. UVE Fails to Recognize Editable Regions
Possible Causes:
Missing or incorrect attribute mappings in the front end.
Content structure inconsistencies between dotCMS and the application.
The front-end framework is not properly rendering editable regions.
Troubleshooting Steps:
Ensure that content blocks are wrapped with UVE-compatible attributes. E.g:
For containers:
data-dot-object = “container”
data-dot-accept-types = “Blog,Activity,MyContentType”
data-dot-identifier = “abcd-1234-efgh-5678” or “//demo.dotcms.com/application/containers/default/”
data-dot-max-contentlets = “3”
data-dot-uuid = “124213”
For contentlets:
data-dot-object = “contentlet”
data-dot-identifier = “abcd-1234-efgh-5678” or “abcd1234efgh5678”
data-dot-basetype = “WIDGET”
data-dot-title = “My cool Contentlet”
data-dot-inode = “abcd1234efgh5678”
data-dot-type = “MyCoolContentType”
data-dot-container = “{ This should be a JSON string of the parent container }”
data-dot-on-number-of-pages = “2”
Check that the content structure in dotCMS matches what is expected by the front-end application.
Review JavaScript framework rendering behavior, ensuring it does not interfere with UVE’s dynamic updates.
Use the Content Search Tool to verify that content exists and is queryable.
Helpful Hint: Open your browser’s Developer Tools to inspect HTML elements and verify their properties. Use the inspector’s search function (CMD+F on Mac or Win+F on PC) to quickly locate specific attributes within the HTML structure.
4. API Rate Limits or Performance Issues
Possible Causes:
High-frequency API calls exceeding rate limits.
Inefficient content querying.
Back-end latency affecting responses.
Troubleshooting Steps:
Optimize API requests by caching frequently accessed content.
Use pagination when fetching large datasets to reduce API load.
Monitor dotCMS performance metrics and adjust server resources if necessary.
Manage caching mechanisms effectively and clear caches when necessary.
5. Publishing and Workflow Issues
Possible Causes:
Delayed or stuck push publishing actions.
Workflow tasks not being assigned correctly.
Troubleshooting Steps:
Check the Publishing Queue under Site > Publishing Queue to troubleshoot stuck or failed publishing actions.
Use the Workflow Task Manager under Roles & Tools to ensure that content approval workflows are functioning correctly.
6. Responsive and UI Issues
Possible Causes:
Front end not adapting to different screen sizes.
Issues with dynamic content display.
Conflicts with .container class in the front end (slated to become “.dot-container” in an upcoming release to avoid naming conflicts).
Troubleshooting Steps:
Use the Preview dropdown options in the UVE to test designs across different resolutions and device types.
Validate front-end CSS and responsive behavior to ensure consistent content display.
Avoid conflicts by ensuring that .container classes in your front end do not override dotCMS’s default container styles, as this can misalign UVE elements.
Best Practices for a Smooth UVE Experience
Use dotCMS’s Headless API Documentation: Ensure your integration follows best practices outlined in dotCMS’s API reference.
Enable Detailed Logging: Debugging logs can provide valuable insights into API responses and JavaScript execution.
Keep dotCMS and Your Application Updated: Regularly update to the latest dotCMS version and dependencies to benefit from performance improvements and bug fixes.
Test in a Staging Environment: Validate changes in a staging instance before deploying to production.
Engage with dotCMS Support and Community: If issues persist, leverage dotCMS support channels and developer forums for additional insights.
Regularly Communicate with Your Team: Keep track of local overrides and update the allowedDevURLs list as needed.
Additional Resources
For further insights and technical guidance, check out the latest resources from dotCMS:
Recent Videos on UVE:
Recent Blogs on UVE:
Latest dotCMS Documentation on UVE:
By following these troubleshooting steps and best practices, developers can ensure a seamless Universal Visual Editor experience, enabling content teams to work efficiently while maintaining a headless architecture.