👋 Hi!
It’s time for XM Cloud 🌥️ in this Blog!
After a long and tiring May, I found a short time on the last day to put my hands-on this new piece of technology provided by Sitecore.
I decided to prepare my local computer to run locally the Sitecore XM Cloud.
To set up my local environment, I followed the XM Cloud Tutorial Series created by Sebastian Winter. You can watch it here.
During this process, I encountered several errors, mostly related to environment issues. Let’s take a look at 5 common problems and their solutions.
Pre-requisites
Before diving into the issues, I recommend checking out the pre-requisites. This article by David Austin from FishTank is a great resource for reviewing any details that might have been missed in the video.
Issue 1) Init.ps1
The first issue that I faced was:
Register-PSRepository : The specified Uri 'https://nuget.sitecore.com/resources/v2' for parameter 'SourceLocation' is
an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
At C:\dev\xm-cloud-demo\init.ps1:49 char:5
+ Register-PSRepository -Name SitecoreGallery -SourceLocation https ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (https://nuget.sitecore.com/resources/v2:String) [Register-PSRepository
], ArgumentException
+ FullyQualifiedErrorId : InvalidWebUri,Register-PSRepository
Solutions:
- Restart your computer – Surprisingly, this worked for me. Sometimes the console needs a ‘refresh’ to function properly
- StackOverflow Workaround – Check this comment on StackOverflow for an alternative solution.
- Change the Installation Policy – Modify the policy from Trusted to Untrusted at line 49 in
init.ps1
. - Update PowerShell – Ensure you have a newer version of PowerShell (> 5 version).
Issue 2) Up.ps1
Then, I got this error:
PS C:\Dev\xm-cloud-demo> .\up.ps1
Expiration 01/01/2100 00:00:00
The license is valid. 27607 days left until expiration.
Set-EnvFileVariable: C:\Dev\xm-cloud-demo\up.ps1:34:5
Line |
34 | Set-EnvFileVariable "NODEJS_VERSION" -Value $xmCloudBuild.renderi …
| ~~~~~~~~~~~~~~~~~~~
| The term 'Set-EnvFileVariable' is not recognized as a name of a cmdlet, function, script file, or executable
| program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Which has a very simple solution:
- Run your IDE or console app in a Administrator Mode.
Issue 3) Another Up.ps1 problem
At least, this was easier.
Building containers...
time="2024-05-31T11:59:09-03:00" level=warning msg="The \"SITECORE_XmCloud_dot_TenantId\" variable is not set. Defaulting to a blank string."
error during connect: in the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/_ping": open //./pipe/docker_engine: The system cannot find the file specified.
Write-Error: Container build failed, see errors above.
Solution:
As pointed by David Austin, the solution is:
If you encounter the following error this is due to the Windows Container not running. If you check Docker in the system tray most likely your still on Linux Containers.
So just Run the Docker application, don’t forget to run the Docker service, and switch from Linux to Windows containers.
Issue 4) Up.ps1 again…
Yeah, we still have problems within the Up.ps1. The error:
Error response from daemon: failed to create endpoint sxastarter-traefik-1 on network sxastarter_default: failed during hnsCallRawResponse: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20)
Waiting for CM to become available...
Invoke-RestMethod: C:\Dev\xm-cloud-demo\up.ps1:67:19
Line |
67 | … $status = Invoke-RestMethod "http://localhost:8079/api/http/routers …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No connection could be made because the target machine actively refused it.
Solution:
This issue is due to the Traefik container attempting to use the same port as another application. Try the following:
- In a console, type
iisreset /stop
. - Stop all services related to Sitecore, Solr, and SQL Server
No way? Still seeing errors? Then I recommend a ‘hard reset’
In a console, type the following:
docker-compose stop
docker-compose down
iisreset /stop
- docker network prune
- .\init.ps1
- .\up.ps1
Issue 5) Random Error
Somewhere down the road I faced this one:
Waiting for CM to become available...
Write-Error: Timeout waiting for Sitecore CM to become available via Traefik proxy. Check CM container logs.
And found the Erica’s answers.
Other tips)
- Check the health of your containers and ensure there are no errors.
- All good? So you should be able to see the initial launchpad:
Did you find more errors? Would you like to improve or contribute to this article? So please, get in touch with me.
See you!
Leave a Reply