Common Errors and Solutions - What worked for me...
This is a personal list of developer-related errors in one blog post and will keep this up-to-date with new ones as i encounter. Also, use these errors and solutions with a pinch of salt since what worked for me might not work for you. So, exercise some caution, analyse your situation before you use these options. Thanks for reading.
18/Jan/24
**********************************************************
Context: While running .\up.ps1 for Sitecore XM Cloud project, I received the following error out of the blue in PS command prompt. I then remembered tampering with package source mapping while setting up another project' solution. So, revisited the package mapping related dialogs.
In Visual Studio 2022, Tools > Options > Package Sources looked like this:
Package Source mapping looked like this:Note that Package Source mapping is a VS 2022 feature unavailable in VS 2019.
What worked for me?
Since nusource was missing, I clicked Remove All option to remove all packages and tried up.ps1 and it worked for me.
After removing all mappings, my package sources also looked better than before and I also ensured other project solutions built and worked fine.
Error:
Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageInstallerException: Package Source Mapping is enabled, but no source found under the specified package ID: sitecore.cli. See the documentation for Package Source Mapping at https://aka.ms/nuget-package-source-mapping for more details.
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.LoadNuGetSources(PackageId packageId, PackageSourceLocation packageSourceLocation, PackageSourceMapping packageSourceMapping)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetPackageSourceAndVersion(PackageId packageId, NuGetVersion packageVersion, PackageSourceLocation packageSourceLocation, Boolean includePreview, Boolean includeUnlisted, PackageSourceMapping packageSourceMapping)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.DownloadPackageAsync(PackageId packageId, NuGetVersion packageVersion, PackageSourceLocation packageSourceLocation, Boolean includePreview, Boolean includeUnlisted, Nullable`1 downloadFolder, PackageSourceMapping packageSourceMapping)
at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.DownloadAndExtractPackage(PackageLocation packageLocation, PackageId packageId, INuGetPackageDownloader nugetPackageDownloader, String packagesRootPath, IToolPackageStore toolPackageStore, NuGetVersion packageVersion, PackageSourceLocation packageSourceLocation, Boolean includeUnlisted)
at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Tools.Tool.Restore.ToolRestoreCommand.InstallPackages(ToolManifestPackage package, Nullable`1 configFile)
at Microsoft.DotNet.Tools.Tool.Restore.ToolRestoreCommand.<>c__DisplayClass10_0.<Execute>b__0(ToolManifestPackage package)
at System.Linq.Enumerable.SelectArrayIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.DotNet.Tools.Tool.Restore.ToolRestoreCommand.Execute()
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
Installing Sitecore CLI Plugins...
Run "dotnet tool restore" to make the "sitecore" command available.
C:\projects\tst\XM-Cloud-Introduction\up.ps1 : Unexpected error installing Sitecore CLI Plugins
At line:1 char:1
+ .\up.ps1
+ ~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,up.ps1
**********************************************************
20/Jan/24
********************************************************
Context: While running .\up.ps1 for Sitecore XM Cloud project, I usually receive the following error in PS command prompt.
The temporary workaround is run docker system prune -a and then try up.ps1.
Error:
Starting Sitecore environment, all roles running locally...
time="2024-01-20T08:06:17+11:00" level=warning msg="a network with name xm-cloud-introduction_default exists but was not created by compose.\nSet `external: true` to use an existing network"
network xm-cloud-introduction_default was found but has incorrect label com.docker.compose.network set to ""
Waiting for CM to become available...
Invoke-RestMethod : Unable to connect to the remote server
At C:\projects\tst\XM-Cloud-Introduction\up.ps1:114 char:23
+ ... $status = Invoke-RestMethod "http://localhost:8079/api/http/routers ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
********************************************************
9/Feb/24
Another reason for "CM container is unhealthy"
Invoke-RestMethod : Unable to connect to the remote server
+ ... $status = Invoke-RestMethod "http://localhost:8079/api/http/routers ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Execute docker container inspect <CM container id>
This should give details as follows:
With the ip address fetched from above log, access the url as follows in the browser:
http://172.22.94.211/healthz/ready
Then, you get the actual ysod with the error to be addressed:
Server Error in '/' Application.
Could not load type 'Sitecore.ExperienceEdge.Connector.Abstraction.IManifestService' from assembly 'Sitecore.ExperienceEdge.Connector.Abstraction, Version=18.0.0.0, Culture=neutral, PublicKeyToken=null'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'Sitecore.ExperienceEdge.Connector.Abstraction.IManifestService' from assembly 'Sitecore.ExperienceEdge.Connector.Abstraction, Version=18.0.0.0, Culture=neutral, PublicKeyToken=null'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
|
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4654.0
***********************
23/feb/24
Error:
"container prune" requires API version 1.25, but the Docker daemon API version is 1.24
Context: Occurred when trying to run docker system prune -a
Reason: Docker desktop was not running, so started docker desktop, tried prune and it worked!
*******************
Comments
Post a Comment