Thursday, August 10, 2023

Navigating Sitecore JSS Docker : Unpacking the "System Network Error (ambiguous (2 matches)" Conundrum and its Resolution



After reinstalling Docker, I encountered a familiar yet confounding error. While Docker is generally renowned for its reliability, this particular issue is relatively common. The error message in question pertained to network management, and I initially tried to address it through conventional Docker commands like listing and removing networks. However, my efforts proved futile, as I received an error message stating that the network was a "system network" and could not be deleted. Frustrated but undeterred, I discovered a remarkably simple solution that may prove helpful to other Docker users in a similar predicament - restarting my machine.

Understanding the Problem:

Docker users often create networks to facilitate communication between containers. These networks are the lifeblood of Docker's infrastructure, enabling the seamless exchange of data and services. However, the "system network" label signifies that a network is essential for Docker's core functionality and cannot be removed through conventional means. This can be a vexing problem for users trying to manage their Docker networks, as the error message seems to deny the basic action of network removal.

The Solution:

When faced with this issue, there are various suggested approaches to resolve it. However, one particularly straightforward and effective method is to restart your machine. Here's a step-by-step guide:

Save your work and close any active Docker containers or Docker-related applications.

Proceed to restart your computer or server.

Once the restart is complete, open Docker and attempt to delete the problematic network using the "docker network rm" command again:

docker network rm <network-id>

In most instances, you'll find that the network can now be removed without encountering the "system network" error message. The restart essentially resets Docker's internal state, resolving any underlying conflicts or issues that may have contributed to the error.

Conclusion:


The "system network cannot be deleted" error can be a vexing obstacle for Docker users. Still, as we've explored, a simple machine restart often proves to be a reliable and efficient solution. Docker is a powerful tool, but it's not immune to the occasional hiccup. Developing the know-how to troubleshoot and resolve such issues is a valuable skill for any Docker user, ensuring a smoother containerization experience.

Wednesday, July 12, 2023

Setup Postman collection for Order cloud

Introduction

Postman collections are essential for API development as they facilitate testing, documentation, collaboration, automation, and security testing. They help ensure API reliability and performance while enabling efficient team collaboration.

Sitecore Order Cloud offers a default set of APIs.

Steps to setup and access

Go to this Sitecore Postman collection, Here is the link to access it - OrderCloud API Exercise 


Click "Run" in Postman, which will provide you with the option to open the Postman collection in either your browser or the Postman desktop application.

It's advisable to establish a Postman team collection that's specific to the project, allowing for easy modification and sharing within the team.

It's a good practice to setup a new space and do the source control all the key API's and collection so this can be shred withing the team



Key Benefits:

  • Improved collaboration and knowledge sharing
  • Version control for consistent API development
  • Reusable components for faster development
  • Centralized documentation for easy access

Practices:

  • Create a dedicated Postman workspace for APIs
  • Integrate source control to track and revert changes
  • Use consistent naming conventions for clarity
  • Encourage regular updates to reflect API changes
  • Implement code review for quality and consistency
  • Establish documentation standards for clarity


Friday, July 7, 2023

Sitecore Xm Cloud - Navigating React Hooks: Addressing useEffect Missing Dependency Warnings and Escaping Quotation Marks

 Recently I got below error while building and deploying the XM Cloud project





 +00:00|INFO|114:5  Warning: React Hook useEffect has a missing dependency: 'facets'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps

39:13  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities

  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities


to fix this issue for temprary I disabled below settings.

 "@typescript-eslint/no-unused-vars": "off",
    "@typescript-eslint/no-explicit-any": "off",
    "react/no-unescaped-entities": "off",
    "@next/next/no-page-custom-font": "off",

Wednesday, June 14, 2023

Fixing Package Installation Error: Version Conflict in Sitecore CLI

During the initial stages of building my Sitecore project using Bitbucket pipelines, I encountered a critical roadblock: a version conflict with the sitecore.cli package. The error message indicated that the manifest file already contained version 5.1.25, conflicting with the desired version, 5.2.113. To address this, a targeted fix involved updating the dotnet-tools.json file manually. In this technical account, I'll provide a detailed walkthrough of this fix.

The Issue: Version Mismatch in sitecore.cli

The error message "Cannot add package. Manifest file already contains version 5.1.25 of the package sitecore.cli" pinpointed a version conflict during the build process. The challenge was to rectify this conflict, ensuring alignment with the required version, 5.2.113.

The Fix: Updating dotnet-tools.json

1. Locate dotnet-tools.json

The first step was to navigate to the directory specified in the error message, typically /opt/atlassian/pipelines/agent/build/.config/. Here, the dotnet-tools.json file resides.

2. Open for Editing

Once located, I opened the dotnet-tools.json file for editing. This can be achieved through any preferred text editor or integrated development environment (IDE).

3. Update sitecore.cli Version

Within the file, I identified the entry for sitecore.cli and manually updated the version number to 5.2.113. This involved changing the existing version, usually set at 5.1.25, to the required version.

4. Save Changes

After making the necessary adjustment, I saved the changes to the dotnet-tools.json file, ensuring that the updated version number for sitecore.cli was persisted.

5. Retry Package Installation

With the file updated, I retried the package installation process. The purpose was to confirm that the correct version, 5.2.113, was now being utilized without encountering the previous version conflict.

6. Verify Compatibility

Before concluding the fix, it was imperative to verify the compatibility of version 5.2.113 with the project's requirements. This involved checking for any additional dependencies or behavioral changes.

Conclusion

By strategically editing the dotnet-tools.json file, specifically updating the version of the sitecore.cli package, the version conflict was successfully resolved. This targeted fix allowed for a seamless build process, ensuring that the correct version was utilized during the Sitecore project development within Bitbucket pipelines. The manual edit of the manifest file provides a precise solution for version conflicts, demonstrating the power of nuanced adjustments in the development workflow. As always, adapt these steps to your specific scenario and leverage the broader development community for insights and collaboration. Happy coding!

Friday, June 9, 2023

Unleashing the Power of Sitecore OrderCloud: A Technical Deep Dive



Introduction:

Embark on a technical journey into the heart of Sitecore OrderCloud, a robust e-commerce solution seamlessly operating on Microsoft Azure. In this blog post, we explore its microservices architecture, integration points, compliance features, and the intricacies of every interaction through the OrderCloud API. Let's dive in.

Image Source - Sitecore Order Cloud

Microservices Architecture and Cloud-Native Approach:

OrderCloud leverages a microservices architecture, embracing the scalability and flexibility offered by cloud-native solutions. We'll dissect the layers of its architecture, exploring how each microservice contributes to the platform's agility.

Integration Points:

Explore the diverse integration points that make OrderCloud a powerhouse in the e-commerce landscape. From data synchronization to third-party service integration, we'll unravel the seamless connectivity that ensures a cohesive e-commerce experience.

Webhooks and Integration Events:

Delve into the world of webhooks and integration events, crucial components for real-time communication and data synchronization. We'll discuss their role in maintaining a synchronized ecosystem, enabling timely updates and actions across the OrderCloud platform.

Security and Compliance:

OrderCloud's commitment to security is evident in its annual SOC 2 Type 2 audits. We'll explore the platform's compliance with GDPR and CCPA, ensuring that businesses using OrderCloud can confidently navigate the complex landscape of data protection and privacy regulations.

User Context in API Interactions:

Uncover the importance of user context in every interaction with the OrderCloud API. We'll discuss how this user-centric approach enhances security, personalization, and overall user experience within the e-commerce ecosystem.

Conclusion:

In this technical exploration, we've scratched the surface of Sitecore OrderCloud's capabilities. From its microservices architecture to robust integration points and unwavering commitment to security and compliance, OrderCloud stands as a testament to the evolution of e-commerce on the cloud. As businesses navigate the digital landscape, understanding the technical intricacies of platforms like OrderCloud becomes paramount for success.

Wednesday, May 17, 2023

Troubleshooting and Resolving Sitecore XM Cloud Deployment Issue: Rendering Host Build Failed

 



In this blog post, learn how to identify and resolve problems lurking in your code, like unused variables. We'll explore my personal encounter with this challenge and discuss alternative solutions, including the power of configuration tweaks to disable specific features. Uncover the secrets of efficient debugging and enhance your coding prowess today

"no-unused-vars": "off"
Troubleshooting Steps
Troubleshooting Steps

Check ESLint's output for "no-unused-vars" warnings. Identify which variables are reported as unused.
Update TypeScript File:

In your TypeScript file, address the warnings by either using the variables or 
removing them if unnecessary.
ESLint Configuration:

Ensure your ESLint configuration includes proper TypeScript rules. Adjust the "no-unused-vars"
rule to match your project's requirements.


After updating the TypeScript file and ESLint configuration, re-run ESLint to verify that 
the "no-unused-vars" issues are resolved. By updating the TypeScript file and configuring ESLint
appropriately, you can quickly resolve "no-unused-vars" issues 
and maintain a clean and efficient codebase.

Saturday, April 8, 2023

Resolving the "No CORS Policy Found" Error in Sitecore 10.3 Identity Server




Encountering the Sitecore Identity Server error, specifically the "No CORS policy found for the specified request" issue, can be a frustrating experience for developers and administrators. In this blog post, we'll delve into the details of this error and provide a practical solution to address it.

Error Details:

The error message points to a problem with the CORS (Cross-Origin Resource Sharing) policy, specifically when the request origin is set to "null," indicating that it doesn't have permission to access the resource. The log entries show the execution of the relevant endpoint in the Identity Server, followed by an unhandled exception related to a SQL Server connection issue.

Error Log:

(Sitecore Identity/AA0001) Request origin "null" does not have permission to access the resource.

(Sitecore Identity/AA0001) No CORS policy found for the specified request.

(Sitecore Identity/AA0001) Executing endpoint '"Sitecore.Plugin.IdentityServer.Controllers.AccountController.Login (Sitecore.Plugin.IdentityServer)"'

[INF] (Sitecore Identity/AA0001) Route matched with "{action = \"Login\", controller = \"Account\"}". Executing controller action...

[INF] (Sitecore Identity/AA0001) Executed action "Sitecore.Plugin.IdentityServer.Controllers.AccountController.Login (Sitecore.Plugin.IdentityServer)" in 16964.3894ms

[ERR] (Sitecore Identity/AA0001) An unhandled exception has occurred while executing the request.

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server...

 ---> System.ComponentModel.Win32Exception (2): The system cannot find the file specified.

Solution:

To address this issue, follow these steps:

Investigate the CORS Policy:

Check your Sitecore configuration and ensure that the CORS policy is correctly configured to allow the specified request origin. Review Sitecore documentation and relevant articles to verify the proper CORS setup.

Review External Resources:

The provided Sitecore Stack Exchange link (https://sitecore.stackexchange.com/questions/19242/what-does-this-error-message-in-the-identity-server-logs-mean) can offer valuable insights into similar issues. Explore discussions and solutions from the community.

Check SQL Server Services:

In the presented solution, the root cause was identified as SQL Server services not running. Validate the status of your SQL Server services and restart them if necessary. Ensure that SQL Server is configured to allow remote connections and that the instance name is correct.

Conclusion:

Resolving the "No CORS policy found for the specified request" issue in Sitecore Identity Server involves a comprehensive approach. By investigating the CORS policy, reviewing external resources, and addressing potential SQL Server service issues, you can successfully mitigate this error. Remember to adapt these steps based on your specific environment and configurations.