Showing posts with label XMCloud. Show all posts
Showing posts with label XMCloud. Show all posts

Wednesday, January 1, 2025

XMC how to fix a network with name ABC-xmc_default exists but was not created by compose

Recently during the new XMC project setup, I got below error

 Starting Sitecore environment...

 level=warning msg="a network with name ABC-xmc_default exists but was not created by compose.\nSet `external: true` to use an existing network"

network ABC-xmc_default was found but has incorrect label com.docker.compose.network set to ""

You cannot call a method on a null-valued expression.

At C:\Projects\ABC-xmc\docker\add-host.ps1:8 char:1

+ $containerId = $containerId.Replace("failed to get console mode for s ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], ParentContainsErrorRecordException

    + FullyQualifiedErrorId : InvokeMethodOnNull

Fix

Go to your docker compose overide file and at the last add this lines


networks:
  default:
    external: true
    name: ABC-xmc_default


Tuesday, June 11, 2024

Resolving Multiple HTTPS Entries in Sitemap



Issue Observed:

During a recent project, I observed that multiple HTTPS entries were being generated in the sitemap. This issue not only caused redundancy but also had potential implications for SEO and website performance.

After a detailed investigation, I determined that the problem was related to incorrect configuration settings within Sitecore.


Root Cause Analysis

In Sitecore, the configuration for each site defines how URLs are generated, including protocol and host information. The issue was traced to the following path:


/sitecore/content/Site/Settings/Site Grouping/Site1

Within this configuration, the Target Hostname field included the HTTPS protocol, which resulted in duplicate entries being created in the sitemap.

For example:


https://www.example.com

When the sitemap was generated, this setting caused the URLs to be prefixed incorrectly, leading to multiple instances of HTTPS URLs appearing.

Solution

The fix for this issue was straightforward and involved modifying the Target Hostname setting. Here’s how it was resolved:

  1. Navigate to the Site Settings:

    • Go to: /sitecore/content/Site/Settings/Site Grouping/Site1
  2. Correct the Target Hostname:

    • Remove the HTTPS prefix from the Target Hostname field.
    • Instead of: https://www.example.com
    • Use: www.example.com
  3. Save and Publish the changes to ensure they take effect.

Why This Fix Works

Sitecore generates URLs dynamically based on the Target Hostname configuration. By including the protocol (https://) directly in the Target Hostname field, Sitecore was misinterpreting the setting and creating redundant HTTPS entries.

By specifying only the hostname (www.example.com), Sitecore uses the appropriate protocol based on other configurations, ensuring consistent and accurate URL generation in the sitemap.

Results

After implementing this change:

  • The sitemap no longer displayed duplicate HTTPS entries.
  • URL generation was consistent and aligned with best practices for SEO.
  • The overall sitemap was clean, accurate, and free of redundancy.

Key Takeaways

  • Check Hostname Settings: Always ensure the Target Hostname field contains only the hostname, without protocol prefixes.
  • Follow Best Practices: Let Sitecore handle protocol resolution based on your site's configurations for HTTP and HTTPS.
  • Regular Sitemap Audits: Periodically review your sitemap to identify and address any anomalies that may impact SEO.

By maintaining proper settings in Sitecore, you can avoid sitemap issues and ensure a seamless experience for both search engines and users.

For any additional queries or troubleshooting assistance, feel free to leave a comment or reach out. Happy Sitecore-ing!

Tuesday, April 16, 2024

Troubleshooting Sitecore XM Cloud: Deployment Process Halted with Status Code 409 - Project and Environment Already in Deployment.


Lately, during the construction and deployment of the UAT environment, all builds were stuck in the queue and failed to respond. Despite numerous attempts to delete the builds, the issue persisted.



After posting about the problem in the Slack channel, we were unable to find a definitive solution. Consequently, we raised a Sitecore ticket, seeking assistance with the issue.


Slack Posted Question - I'm currently encountering an issue with deploying a build on the UAT environment. Despite waiting for several hours, the build remains stuck in the queue.


After canceling the build and attempting to restart the environment, it' showing an message  that the build is still running and it's preventing the restart.

Now, every build is getting queued up. Do we have any options available to resolve this issue? the same branch was successfully deployed to a different environment (Dev) without any issues.

I would greatly appreciate it if anyone who has experienced a similar problem could share their suggestions.

Console error was 

{

    "title": "Not Found",

    "status": 404,

    "detail": "Deployment entity not existing for deploymentId XXXXXXXXXX",

    "traceId": "XXXXXXXXXXXXXXXXXX"

}


There was an issue with our service connection, due to which environment was wrongfully marked as having a running deployment, got fix now.

Slack Reference -  Slack Conversation Link



Friday, March 15, 2024

Resolving Static Asset Updates in Vercel for Sitecore XM Cloud Front-End Deployments


Recently, while working on a Sitecore XM Cloud project with a front-end application hosted on Vercel, I encountered an issue where static assets like CSS and images were not updating after a code deployment. This problem persisted despite the deployment process being successfully triggered. Here’s a breakdown of the scenario and how the issue was resolved.

The Problem

After deploying the front-end application to Vercel, the changes made to static files such as CSS and images were not reflected in the live application. Instead, the site continued to serve older versions of these assets. However, the rendering host used for editors in the XM Cloud instance did not exhibit this issue, which added to the complexity of the problem.

Investigating the Issue

The deployment process followed the official Vercel deployment guide for Sitecore XM Cloud front-end applications. Key areas of focus during the investigation included:

  1. Repository Configuration: Verifying that the connected Git repository for the Vercel front-end application was correctly updated with the changes.
  2. Asset Delivery: Understanding how Vercel handles static files during builds and deployments.
  3. XM Cloud Rendering Host: Confirming whether the issue was isolated to Vercel or if it also affected the rendering host in XM Cloud.

Root Cause

The root cause was identified as a result of a new "protected assets" feature introduced by Vercel. This feature restricts access to certain assets, making them unavailable publicly by default. Consequently, static files like CSS and images were not being updated in the deployed application.

The Solution

To resolve the issue:

  1. Adjust Configuration: Ensured that the "protected assets" feature in Vercel was correctly configured to allow public access to static assets.
  2. Commit Changes: Verified that all changes to the static files were committed and pushed to the Git repository connected to the Vercel project.
  3. Redeploy: Triggered a new deployment to Vercel, ensuring the updated assets were included in the build process.

After implementing these steps, the front-end application successfully updated its static assets, and the latest styling and images were displayed as expected.

Key Takeaways

  1. Understand Hosting Features: It’s essential to stay updated on changes and features introduced by hosting platforms like Vercel that could impact deployments.
  2. Validate Deployment Processes: Double-check that all repositories and configurations align with deployment requirements, especially for headless implementations like Sitecore XM Cloud.
  3. Communicate with Support: Engaging with platform support teams can expedite the resolution of complex issues.

By addressing this issue, the front-end application achieved seamless updates, ensuring consistency between deployments and live user experiences. Sharing this resolution may help others facing similar challenges while working with Sitecore XM Cloud and Vercel.

Wednesday, February 7, 2024

Sitecore XM Cloud - Fixing URL Redirections in Next.js on Vercel Using vercel.json



When URLs don't redirect correctly, it can be frustrating. Recently, we faced this challenge in our Next.js app on Vercel. Let's walk through how we tackled it.

Our URLs containing spaces or special characters weren't redirecting properly on Vercel. This glitch disrupted our users' flow and needed fixing ASAP.

Exploring Solutions:

At first, we tried a JavaScript-based approach within our app code. It worked fine locally but didn't cut it on Vercel.

Leveraging vercel.json:

Next, we discovered Vercel's powerful vercel.json file. With it, we could define redirect rules to map old URLs to new ones. Simple yet effective!

Crafting the Solution:

We created a vercel.json file with rewrite rules. These rules told Vercel how to handle URLs with spaces or special characters, ensuring they redirected correctly.


Sample vercel.json Code:


{
    "rewrites": [
      {        
        "source": "/(.*)%20(.*)",
        "destination": "/$1-$2"
      },
      {        
        "source": "/(.*)\\s(.*)",
        "destination": "/$1-$2"
      }
    ]
  }
 

Deployment and Validation:

After updating the vercel.json file, we deployed our Next.js app on Vercel. Through testing, we confirmed that our URLs now redirected smoothly, no more hiccups!

Conclusion:

In our journey to fix URL redirection issues, we learned the power of vercel.json. By leveraging its capabilities, we resolved our problem and improved our users' experience. It's a reminder that sometimes, simple solutions are the best.

Tuesday, January 2, 2024

Unveiling Sitecore XM Cloud: Error Encountered Post-Publishing Visual Studio Project




Recently, I encountered the following error while publishing a Visual Studio project:



Microsoft (R) Visual C# Compiler version 4.8.3761.0

for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.



This compiler is provided as part of the Microsoft (R) .NET Framework, 
but only supports language versions up to C# 5, which is no
 longer the latest version.

Solution

The issue was resolved by deleting the Visual Studio publishing profile. Here’s a step-by-step guide on how to do this:

  1. Open Solution Explorer in Visual Studio.
  2. Navigate to the Properties folder of your project.
  3. Locate and delete the PublishProfiles folder.
  4. Recreate a new publishing profile by following the standard steps for publishing your project.

Conclusion

Deleting and recreating the publishing profile can resolve issues related to compiler versions and ensure your project uses the latest supported C# version. This simple yet effective fix helped me overcome the publishing error and should work for others facing a similar problem.

Tuesday, October 3, 2023

Navigating Sitecore XM Cloud Prompts: Understanding Organization Tiers and Project Limits

Sitecore, a leading digital experience platform, empowers organizations to create seamless and personalized digital experiences. One of the essential features of Sitecore is the ability to organize projects into different tiers within the platform. However, users may encounter a limitation known as the "Organization Tier Project Limit," preventing them from adding more projects. In this technical blog, we'll delve into this issue, exploring its implications and offering potential solutions.

Understanding Organization Tiers:

Sitecore's organizational structure involves the use of tiers to categorize projects. The organization tier serves as the highest level, under which various projects are organized. Each tier represents a level of hierarchy within the platform, allowing for efficient management of digital assets, content, and configurations.

The Challenge: Project Limitation in the Organization Tier

Users often face a roadblock when attempting to add more projects to the organization tier. The platform imposes a project limit within this tier, hindering scalability for organizations with extensive digital initiatives. This limitation may stem from various factors, including licensing constraints, resource allocation, or architectural considerations.




Impact on Organizations:

The project limit within the organization tier can have significant implications for organizations aiming to expand their digital presence. As organizations evolve, they may require the ability to create and manage additional projects within Sitecore to accommodate new initiatives, campaigns, or product launches. The imposed limitation can impede agility and hinder the seamless execution of digital strategies.

Possible Solutions:

Review Licensing and Editions:

Ensure that your Sitecore license supports the desired number of projects within the organization tier. Different Sitecore editions may have varying limits, and upgrading to a higher edition might be a solution.

Optimize Existing Projects:

Evaluate the projects within the organization tier to identify opportunities for optimization. Removing redundant or obsolete projects can free up space for new initiatives.

Engage Sitecore Support:

If the project limitation persists, reaching out to Sitecore Support can provide insights into the specific constraints and potential solutions. Sitecore Support can offer guidance on best practices and assist in resolving licensing or configuration issues.

Conclusion:

The project limit within the Sitecore organization tier is a critical consideration for organizations seeking to scale their digital initiatives. By understanding the factors contributing to this limitation and implementing the suggested solutions, organizations can overcome challenges and continue leveraging Sitecore's powerful capabilities for creating compelling digital experiences. Regularly reviewing licensing, optimizing existing projects, and engaging with Sitecore Support are essential steps in ensuring a seamless and scalable digital experience platform.