A couple of notes involving razl and Sitecore XM Cloud

As developers, Google and StackExchange are our best pals. We rely on them even more than our friends and immediate family members! No wonder most of our problems have a solution in one of these two confidantes. On the other hand, if I encounter a technical problem and I find a solution or someone tells me a solution not presented by our best pals, I add it to my blog drafts and wait until the next time I face the same issue. If the steps in my blog post produce a successful result for the second time too, I usually publish my post. This one passed such a trial. I've added notes for two errors here as part of working with XM Cloud and razl hoping this will be useful for someone else too.

For reminder, there are two types of connections in razl:

- Direct Connection

- Package Connection

Direct Connection:

Direct connection is an old method for connecting to web applications and in this case, the application web root is physically accessible to make the connection along with a razl-genereated Guid.



Package Connection:

Since razl connection to Sitecore XM Cloud environments are package-based or in other words, a code deployment specific to razl must be done to connect to the environment here is a pictorial representation of package-based connection explained here:


RAZL Direct connection vs Package Connection:

CriteriaDirect ConnectionPackage-based Connection
Cloud-based PaaSNY
Razl-based Code ChangesNY
Razl-based Code DeploymentNY
XM Cloud-based ApplicationsNY
On-premise infrastructureYY
Web-service based razlNY
RAZL GUI SupportYY
PowerShell Script SupportYY

Of course for the sake of colors and diagrams as well as to sum up razl connection capabilities in one diagram involving XMC and XM, here is a hybrid connection setup for content migration:

Error-1:

Copy-RazlItemTree : The activation was rejected by the server.

At
C:\razl-scripts\xm-cloud\sync-content-full-legacy-SIT-to-xm-cloud-SIT.ps1:48
char:2
+     Copy-RazlItemTree -source $SourceEnv -target $TargetEnv -ItemId " ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Copy-RazlItemTree], Licen
   seFailureException
    + FullyQualifiedErrorId : CopyItems: An error occured when checking for a  
   license @ 3/14/2024 1:52:51 PM. The error message is: The activation was r  
  ejected by the server..,HedgehogDevelopment.RazlClient.CmdLets.CopyItems
 
Copy-RazlItemTree : Could not find Razl License. Please run Razl.exe and
add/update your license.
At
C:\razl-scripts\xm-cloud\sync-content-full-legacy-SIT-to-xm-cloud-SIT.ps1:48
char:2
+     Copy-RazlItemTree -source $SourceEnv -target $TargetEnv -ItemId " ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-RazlItemTree], InvalidOp
   erationException
    + FullyQualifiedErrorId : System.InvalidOperationException,HedgehogDevelop
   ment.RazlClient.CmdLets.CopyItems


While there is a StackExchange answer for this error that i never tried, the following approach, shared by Rey Rahadian, produced me result in two different occasions and in two different machines while trying to connect to the XMC environment using my razl script. Here are the details:

Since this is an error thrown while running your razl script from PS cmd prompt as admin, open regedit.

Sitecore RAZL License key value in registry must match the license key value in the razl view license screen - Computer\HKEY_CURRENT_USER\Software\HedgehogDevelopment\RAZL



Sitecore RAZL Settings -> View License:


If not, add the correct LicenseKey and razl GUI ProductOwner in the settings and ensure the razl GUI opens fine:


Note that if you don't have the proper key in the razl settings, you get an error in these lines while opening the razl tool - An error occured when checking for a license @ <date time stamp>:




Error-2:

Get-RazlConnection : CallService Exception
At C:\projects\xyz\devops\scripts\content-sync\utils\sync-content-full-from-legacy-to-xmcloud.ps1:27 char:16
+ ... targetEnv = Get-RazlConnection -SitecoreWebUrl $destUrl -DatabaseName ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-RazlConnection], ServerTooBusyException
    + FullyQualifiedErrorId : Razl,HedgehogDevelopment.RazlClient.CmdLets.GetConnection
Get-RazlConnection : CallService Exception
At C:\projects\xyz\devops\scripts\content-sync\utils\sync-content-full-from-legacy-to-xmcloud.ps1:27 char:16
+ ... targetEnv = Get-RazlConnection -SitecoreWebUrl $destUrl -DatabaseName ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-RazlConnection], ServerTooBusyException
    + FullyQualifiedErrorId : Razl,HedgehogDevelopment.RazlClient.CmdLets.GetConnection
Get-RazlConnection : The HTTP service located at
https://xmc-xyzbrands7abc-xyzxmc30c-sandboxace9.sitecorecloud.io/_CMP/RazlService.asmx is unavailable.  This could be because the service is too busy or because no endpoint was found listening at the specified address. Please ensure that the address is correct and try accessing the service again later.

Solution: I'm unsure if this is the actual solution but this seemed a possibility so, adding a note here - Since I hadn't connected to this new XMC environment (from the local machine), I used the razl tool and the package connection option to first connect to the XMC environment using test connection. 



After this, the razl asmx url was accessible and I didn't get the error in the cmd prompt too while running the script.




Comments

Popular Posts