output
stringlengths 34
25.7k
| instruction
stringlengths 81
31k
| input
stringclasses 1
value |
---|---|---|
I can think of the below skeleton test.
[TestClass]
public class MyServiceTests
{
[TestMethod]
public void GetItemByShortPath_Should_Return_Item()
{
// Arrange
var database = new Db
{
new Database.GetItem("Home") { { "Title", "Welcome" } }
};
var siteContext = new SiteContext
{
StartPath = "/sitecore/content/Home",
Database = database.Database
};
var shortPath = "Title";
// Act
var result = MyService.GetItemByShortPath(siteContext, shortPath);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual("Welcome", result["Title"]);
}
[TestMethod]
public void GetItemByShortPath_Should_Return_Null_When_Item_Not_Found()
{
// Arrange
var database = new Db();
var siteContext = new SiteContext
{
StartPath = "/sitecore/content/Home",
Database = database.Database
};
var shortPath = "NonExistentItem";
// Act
var result = MyService.GetItemByShortPath(siteContext, shortPath);
// Assert
Assert.IsNull(result);
}
}
In these test cases:
GetItemByShortPath_Should_Return_Item: This test checks whether the GetItemByShortPath method returns a valid item when given a valid short path.
GetItemByShortPath_Should_Return_Null_When_Item_Not_Found: This test checks whether the GetItemByShortPath method returns null when the item with the specified short path does not exist in the database.
Note:
1. Make sure to change the code according to your solution.
2. Make sure to adjust the test data and assertions as per your
specific requirements and actual implementation.
Hope this might help.
| How to write unit test case for the static class and methods
I have below static class and method written to get the Sitecore Item by its path.
public static class MyService
{
public static Item GetItemByShortPath(SiteContext siteContext, string shortPath)
{
var fullPath = siteContext.StartPath + "/"+ shortPath;
return siteContext.Database.GetItem(fullPath);
}
}
Can someone please help me in writing unit test case for this code?
Thanks,
| |
I installed by following steps:
Created certificates manually:
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "DO_NOT_TRUST_SitecoreRootCert" -FriendlyName "DO_NOT_TRUST_SitecoreRootCertxm" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "sc102xm.identityserver" -FriendlyName "sc102xm.identityserver" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "sc102xm.cm" -FriendlyName "sc102xm.cm" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "sc102xm.cd" -FriendlyName "sc102xm.cd" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
Moved these from personal to trusted root certificates Authorities.
Then ran the installation again using these certificate names.
| Sitecore 10.2 XM installation failing on addwebfeatureSSL
Sitecore 10.2 XM installation is failing at step 40 (refer to screenshot).
I can't clear all certificates and restart because other Sitecore instances are running on the same Azure VM.
| |
Refer to this official document links for Deployment options for JSS Next.js apps.
Node.js Server
Next.js JSS apps can be deployed to any hosting provider or environment that supports Node.js. For more information refer to the following resources:
Next.js documentation on Node.js Server deployment.
A discussion on Next.js and Docker.
Also, refer to this article that explains how to Deploy Sitecore Headless Nextj.js app to Azure Web App.
Hope it helps!
| Self-hosting nextjs
I couldn't find any information online how this can be done with sitecore.
All documentation talk about hosting it on third-party providers such as Vercel or Netfliy.
But it says next js can be hosted on anything that supports node js.
If i want to deploy my infrastructure on VMs (on-premise) only:
How the infrastructure will look like ?
I believe we will need CM but do we still need CDs or just nodes server ?
How SSG / ISR will work ?
I am new to next js, previously with react we used to have CM, CDs and Node servers for SSR but not sure how this setup will work with next js.
| |
Official answer from Sitecore:
We have reproduced a similar behavior where the links were incorrectly resolved as "/sitecore/service/notfound.aspx".
We created a related bug, with public reference number 570892.
More information about public reference numbers can be found here:
https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0853187
The issue happens when the GraphQL queries sent to Edge use "value", for example:
query {
item(path: "/sitecore/content/home", language: "en") {
field(name: "text") {
value
}
}
}
However, if the "jsonValue" is used, the links will be resolved correctly:
query {
item(path: "/sitecore/content/home", language: "en") {
field(name: "text") {
jsonValue
}
}
}
This is because the pipelines to resolve values are all run for jsonValue but not for value. From the documentation: "The various Sitecore Headless SDKs all contain helpers for rendering field values. These helpers assist with rendering complex fields (such as images or links) and editable values in the context of inline editing. Item fields in the Experience Edge schema include jsonValue that outputs the field in a format compatible with these field helpers"
| GraphQL - Internal links rendering as notfound in Rich text field Value
Posting this to help others with this issue, answer below
Issue: We are using Sitecore 10.2 headless on Vercel. On our Edge environment, Rich Text fields that are returned by GraphQL are returning /notfound urls for all internal links. This is only happening on Edge, not on our lower environments. The layoutservice API (/sitecore/api/layout/render) shows the internal links with the correct URLs (<a href=\"/mypage\">My Page</a>); it shows correctly in the GraphQL playground (/sitecore/api/graph/edge/ui) as well (<a href=\"https://my-vercel-url.com/mypage\">); but on our actual page on https://my-vercel-url.com, it renders as "/sitecore/service/notfound.aspx?item=%7b33DB4E97-C5C0-452B-83C3-8FE5FB086E25%7d%40en". This is happening for all internal links, and the linked page is published.
| |
You should always check which version of Solr is compatible with the version of Sitecore you're planning to use.
You're installing Sitecore 9.2 which means you should use Solr 7.5. Working with other version (like you attempted with Solr 9.3.0) can cause installation errors which are easy to notice, or can cause issues while using Solr with Sitecore which can be quite hard to investigate in the future.
Here is the link to Solr Compatibility tables for Sitecore:
https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0227897
And here is current version of the table:
| Installation Failed - Cannot validate argument on parameter 'FilePath'
I am trying to install Sitecore 9.2 but at the end of the process, I am getting an error:
SitecoreSolr_AddSchemaUniqueKeyField [1] : SetXml
Install-sitecoreConfiguration: Cannot validate argument on parameter 'FilePath'. The " Test-Path $_
-PathType Leaf " validation script for the argument with value
"C: \solr\solr-9.3.0\server\solr\obsSad_core_index\conf\managed-schema" did not return a result of True. Determine why the validation script failed, and then try the command again.
At C: \Users\
\Downloads\ Sitecore\XPO-SingleDeveloper.ps1:74 char: 1
+ Install-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-objec
CategoryInfo
: NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId: Microsoft.PowerShell.Commands .WriteErrorException, Install-SitecoreConfiguration
[TIME] 00:04:42
Invoke-SetXmlTask: Cannot validate argument on parameter 'FilePath'. The " Test-Path $_ -PathType Leaf m validation script for the argument with value
"C: \solr\solr-9.3.0\server\solrlobsSad_core_index\conf\managed-schema" did not return a result of True. Determine why the validation script failed, and then try the command again.
At C: \Prodram Files\ WindowsPowerShell\ Modules\ SitecoreInstallFramework\2.3.0\Public\ Install-SitecoreConfiguration.ps1:641 char:47
& $entrv.Task.Command @paramSet | Out-Default
+ CategorvInfo
InvalidData: (:) [Invoke-SetXmlTask]. ParentContainsErrorRecordException
FullyQualifiedErrorld
:ParameterArgumentValidationErrorInvoke-SetXmlTask
And yet the file is present in the specific folder:
The XP0-SingleDeveloper.ps1 file is configured properly.
Thanks for any information you could provide, cheers.
| |
Increasing the max pool size and connection timeout can help. Add Max Pool Size=200;Connection Timeout=500; to each custom SQL query string:
cd:
environment:
Sitecore_ConnectionStrings_Web: Data Source=xxxxxxx;Initial Catalog=xxxxxxx-web-db;User ID=xxxxxxx;Password=xxxxxxx;Max Pool Size=200;Connection Timeout=500;
Sitecore_ConnectionStrings_Core: Data Source=xxxxxxx;Initial Catalog=xxxxxxx-core-db;User ID=xxxxxxx;Password=xxxxxxx;Max Pool Size=200;Connection Timeout=500;
This way, we double the max pool size (default is 100), and we massively increase the connection timeout, which is particularly useful when Sitecore is starting up (it usually takes around 200 seconds in my case) and/or working through large event / publish queues, which is typical if you are connecting to databases that you copied from upstream but didn't run cleanup commands on; in which case, running these cleanup commands will help:
TRUNCATE TABLE [dbo].[EventQueue]
TRUNCATE TABLE [dbo].[PublishQueue]
TRUNCATE TABLE [dbo].[Properties]
# On web db:
TRUNCATE TABLE [dbo].[History]
Otherwise, you can also try restarting SQL server on your host machine prior to docker compose up -d to force close any connections that may not have been properly disposed of (thus flooding the connection pool).
| Docker cd service intermittently fails to start
I am running SQL from my host machine rather than via the OOTB mssql service. I did this by customizing the database query strings in my docker compose override file:
cd:
environment:
Sitecore_ConnectionStrings_Web: Data Source=xxxxxxx;Initial Catalog=xxxxxxx-web-db;User ID=xxxxxxx;Password=xxxxxxx
Sitecore_ConnectionStrings_Core: Data Source=xxxxxxx;Initial Catalog=xxxxxxx-core-db;User ID=xxxxxxx;Password=xxxxxxx
The problem is that my cd service often requires multiple calls of docker compose up -d and docker compose down and a good amount of waiting around before it starts working.
The first time I run docker compose up -d, I will often see:
PS C:\projects\myproject> docker compose up -d
[+] Running 12/12
β Network myproject_default Created 0.5s
β Container myproject-solr-1 Healthy 43.3s
β Container myproject-redis-1 Started 4.6s
β Container myproject-mssql-1 Healthy 38.9s
β Container myproject-solution-1 Started 5.4s
β Container myproject-mssql-init-1 Healthy 65.3s
β Container myproject-solr-init-1 Started 47.4s
β Container myproject-id-1 Healthy 109.1s
β Container myproject-cd-1 Error 315.1s
β Container myproject-cm-1 Started 71.2s
β Container myproject-hrz-1 Healthy 104.0s
β Container myproject-traefik-1 Created 0.2s
dependency failed to start: container myproject-cd-1 is unhealthy
Looking at the Docker logs, I see:
2023-09-20 14:57:42 myproject-cd-1 | [2023-09-20T20:57:42.000Z][LOGMONITOR] ERROR: Error in log file monitor. Failed to query file information. File: \\?\c:\inetpub\wwwroot\App_Data\logs\log.20230914.152738.txt. Error: 50
When I inspect that log file I see no notable WARN or ERROR entries. All I see is the site shutting down:
**********************************************************************
**********************************************************************
668 15:28:23 INFO **************************************************
668 15:28:23 WARN Sitecore shutting down
668 15:28:23 WARN Shutdown message: Initialization Error
HostingEnvironment initiated shutdown
I open terminal on the cd service and run a health check:
curl http://127.0.0.1/healthz/ready
[InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may h
ave occurred because all pooled connections were in use and max pool size was reached.]
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbCon
nectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection) +1318
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connec
tionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +307
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +198
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +422
System.Data.SqlClient.SqlConnection.Open() +199
Sitecore.Data.DataProviders.Sql.DataProviderCommand..ctor(IDbCommand command, DataProviderTransaction transaction, Boolean openC
onnection) +113
Sitecore.Data.DataProviders.Sql.&lt;&gt;c__DisplayClass26_0.&lt;CreateCommand&gt;b__0() +48
Sitecore.Data.DataProviders.NullRetryer.Execute(Func`1 action, Action recover) +293
Sitecore.Data.DataProviders.Sql.&lt;&gt;c__DisplayClass29_0.&lt;CreateReader&gt;b__0() +30
Sitecore.Data.DataProviders.NullRetryer.Execute(Func`1 action, Action recover) +293
Sitecore.Data.DataProviders.Sql.SqlDataApi.CreateReader(String sql, Object[] parameters) +281
Sitecore.Data.DataProviders.Sql.&lt;&gt;c__DisplayClass92_0.&lt;SelectIDs&gt;b__0(Int32 batchNumber) +594
System.Threading.Tasks.&lt;&gt;c__DisplayClass17_0`1.&lt;ForWorker&gt;b__1() +1396
System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) +32
System.Threading.Tasks.&lt;&gt;c__DisplayClass176_0.&lt;ExecuteSelfReplicating&gt;b__0(Object &lt;p0&gt;) +278
[AggregateException: One or more errors occurred.]
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +4674501
System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +14248496
System.Threading.Tasks.Parallel.ForWorker(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body
, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) +1446
System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body) +113
Sitecore.Data.DataProviders.Sql.SqlDataProvider.SelectIDs(ID[] filterIds, CallContext context) +275
Sitecore.Data.DataProviders.Sql.SqlDataProvider.PrefetchNotExistedItems(IdCollection prefetchingItems, CallContext context) +102
Sitecore.Data.DataProviders.CompositeDataProvider.PrefetchResourceItems() +688
Sitecore.Data.DefaultDatabase.AddDataProvider(DataProvider provider) +49
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +132
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture) +146
Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties) +853
Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Bool
ean deferred, IFactoryHelper helper) +641
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helpe
r) +326
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +703
Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert) +157
Sitecore.Configuration.DefaultFactory.GetDatabase(String name) +55
Sitecore.Configuration.DefaultFactory.GetDatabases() +121
Sitecore.Data.SqlServer.SqlServerLinkDataProviderFactory.CreateProvidersForAllDatabases() +161
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +269
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture) +146
Sitecore.Reflection.ReflectionUtil.CallStaticMethod(String typeName, String methodName, Object[] parameters) +165
Sitecore.Configuration.DefaultFactory.CreateFromFactoryMethod(XmlNode configNode, String[] parameters, Boolean assert) +534
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helpe
r) +91
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
Sitecore.Configuration.DefaultFactory.GetConstructorParameters(XmlNode configNode, String[] parameters, Boolean assert) +161
Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +114
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helpe
r) +163
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +703
Sitecore.Configuration.DefaultFactory.GetLinkDatabase() +36
Sitecore.DefaultGlobals.Load() +294
(Object , Object ) +55
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfN
otExists) +236
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Nexus.Web.HttpModule.Application_Start() +146
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +918
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +584
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context
) +168
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724
<!--
[InvalidOperationException]: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may
have occurred because all pooled connections were in use and max pool size was reached.
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, Db
ConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory con
nectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Sitecore.Data.DataProviders.Sql.DataProviderCommand..ctor(IDbCommand command, DataProviderTransaction transaction, Boolean op
enConnection)
at Sitecore.Data.DataProviders.Sql.SqlDataApi.<>c__DisplayClass26_0.<CreateCommand>b__0()
at Sitecore.Data.DataProviders.NullRetryer.Execute[T](Func`1 action, Action recover)
at Sitecore.Data.DataProviders.Sql.SqlDataApi.<>c__DisplayClass29_0.<CreateReader>b__0()
at Sitecore.Data.DataProviders.NullRetryer.Execute[T](Func`1 action, Action recover)
at Sitecore.Data.DataProviders.Sql.SqlDataApi.CreateReader(String sql, Object[] parameters)
at Sitecore.Data.DataProviders.Sql.SqlDataProvider.<>c__DisplayClass92_0.<SelectIDs>b__0(Int32 batchNumber)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
[AggregateException]: One or more errors occurred.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Ac
tion`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body)
at Sitecore.Data.DataProviders.Sql.SqlDataProvider.SelectIDs(ID[] filterIds, CallContext context)
at Sitecore.Data.DataProviders.Sql.SqlDataProvider.PrefetchNotExistedItems(IdCollection prefetchingItems, CallContext context)
at Sitecore.Data.DataProviders.CompositeDataProvider.PrefetchResourceItems()
at Sitecore.Data.DefaultDatabase.AddDataProvider(DataProvider provider)
[TargetInvocationException]: Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureIn
fo culture)
at Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties)
at Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, B
oolean deferred, IFactoryHelper helper)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper he
lper)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert)
at Sitecore.Configuration.DefaultFactory.GetDatabase(String name)
at Sitecore.Configuration.DefaultFactory.GetDatabases()
at Sitecore.Data.SqlServer.SqlServerLinkDataProviderFactory.CreateProvidersForAllDatabases()
[TargetInvocationException]: Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureIn
fo culture)
at Sitecore.Reflection.ReflectionUtil.CallStaticMethod(String typeName, String methodName, Object[] parameters)
at Sitecore.Configuration.DefaultFactory.CreateFromFactoryMethod(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper he
lper)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.GetConstructorParameters(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper he
lper)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.GetLinkDatabase()
at Sitecore.DefaultGlobals.Load()
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean fail
IfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Nexus.Web.HttpModule.Application_Start()
at Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext cont
ext)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
[HttpException]: Exception has been thrown by the target of an invocation.
at System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
-->
I have seen similar Q&As recommend increasing the PagePreview.MaxSessionsCount in the main site config. That doesn't help.
What can I do to resolve this?
| |
Can you check the following :
Check if you have a Firewall or VPN which is denying access.
Note that Sitecore instance host and LayoutServiceHost can be different.
E.g. in example below the Sitecore instance name in my local is "https://searchdemosc.dev.local" and Sitecore API or Layout Service Host is "https://jsshomepage"
Check the api key, deployment secret are correctly matching in scjssconfig.jss and .env files as shown below :
Check if https is used e.g. SITECORE_API_HOST=https://jsshomepage in .env file, then you have https binding in IIS. If not Try changing the host to http.
Make sure your Sitecore License has JSS license included
| An invalid request was sent to the Sitecore layout service
I have a Sitecore 10.3 XP installation and a Visual Studio solution with Helix, where we are implementing components. My local Sitecore CM installation is running perfectly fine. However, when I am trying to run my VS solution, I am getting the error An invalid request was sent to the Sitecore layout service. We are using JSS headless implementation and even though everything is correctly installed and verified, I have an access denied message from the JSS API key:
https://unify-103-xp-sc.dev.local/sitecore/api/layout/render/jss?item=/&sc_apikey={key}&sc_site={website-name}
Any suggestion/direction will be highly appreciated.
I tested the graphQL API and it is working fine. I have re-installed JSS headless implementation and by looking at the folder structure it looked okay I verified that in the web database, the key is the same as in master I verified the publishing is done Somehow I am getting access denied for the JSS headless API key.
| |
IAR items are created as part of your serialization. That page will be included in your source control as a serialized item. The only way to delete it would be to remove the item from source control and redeploy your application.
| How to delete Item as Resource ( IAR ) from XM - Cloud?
I created a Page in XM Cloud, and now I am unable to delete the page, It is showing a warning message
Some items are in resources and cannot be deleted.
And now after refreshing the screen, the page items are still there. (restored from resources)
After investigating I found out that the items are created as IAR, but now the question is how? I only made a simple page how did it get stored in the resource?
How are items automatically created as IAR (items as resources) in XM β Cloud?
And how to delete these items from XM Cloud?
| |
So we can mark this as answered:
In the muiltisite module, you don't need to manually create the _site_<sitename> folders, the SDK will create those for you. You need to make sure that the [[...path]].tsx file is in the root of your /src/pages folder.
This will then execute correctly and the middleware will handle the rewrites for multiple sites.
| Next.js multisite plugin context is not returning rewrite path
I am using next.js multisite plugin
https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-headless-development/the-next-js-multisite-add-on.html
I have configured 2 sites in env.sites, cft and mpoc. JSS app name is cft. I have created _site_cft and _site_mpoc rewrite paths under src/pages. But, the app always fetches cft layout data even for mpoc hostname. I have turned on the debugger on middleware and added some logs. The middleware is redirecting correctly but getstaticpaths context in [[,,path]].tsx file not containing site rewrite path. Due to this, page props factory always calling layoutdata of cft
Will be great if someone can help on this
Thanks
| |
After spending many hours, comparing old configs of Sitecore 9.0.2 with Sitecore 9.3 and trying different things, I got the solution.
Problem with a service configuration that works fine in 9.0.2 instances like the below configuration.
<configuration>
<sitecore>
<services>
<register serviceType="MyAssembly.Repositories.IPageListRepository, MyAssembly" implementationType="MyAssembly.Repositories.PageListRepository, MyAssembly" lifetime="Singleton"/>
</services>
</sitecore>
</configuration>
To make it work we have to change it with as below (lifetime="Transient")
<register serviceType="MyAssembly.Repositories.IPageListRepository, MyAssembly" implementationType="MyAssembly.Repositories.PageListRepository, MyAssembly" lifetime="Transient"/>
Hope it helps!
| Custom Page List Component always get same datasource value
We have recently upgraded the project from Sitecore 9.0.2 to Sitecore9.3. There is a component called Page List and we have created a custom component from it as per custom need and it was working fine with Sitecore 9.0.2. We have configured this custom component on many pages.
After the upgrade, I faced a strange issue while loading a page from any of the pages first time it loaded fine (with the correct datasource) but other pages also loaded the same data as the first page. I've verified all the pages have different datasource values configured in the field.
There is no caching issue, I tried clearing the cache also there is no caching applied on the Component/Rendering level.
We always receive the same DataSource value from Rendering.
Does anyone face such an issue with Sitecore 9.3?
Thanks in Advance!
| |
This is a known issue with Sitecore 9.3 and If the default Home item is deleted, then recently uploaded files are not shown in the Select media dialog.
To resolve the issue, consider one of the following options:
Upgrade Sitecore XP instance to 10.0.0 or later.
Recover the default Home item as follows:
Install a new Sitecore XP instance.
Create a Sitecore package with a default "Home" item from a clear instance.
Install this package in the affected instance.
Reference: Select media dialog does not show any images if the default "Home" item is deleted
Hope it helps!
| Media (Images) not loading and media dialog shows error
We have upgraded Sitecore 9.0.2 to Sitecore 9.3 and it is SXA based solution.
And media search is not working after the upgrade. The Media dialog box shows an empty result and returns a response as below in the OOTB API call.
{
"statusCode": 500,
"error": {
"message": "Exception has been thrown by the target of an invocation."
}
}
Error screen with the console:
I already tried this solution but not working for me, also tried rebuilding the index with no luck there.
If you have any suggestions or solutions. Will be Happy to hear you.
Thanks in Advance!
| |
You need additional check for Internal links in other answers, Here is your final script -
# Get Home items
$root = Get-Item -Path "master:/sitecore/content/Home"
# Get its descendents
$allItems = @( ($root.Axes.GetDescendants() | Initialize-Item))
# Get all including Home
#$allItems = @($root) + @(($root.Axes.GetDescendants() | Initialize-Item))
$allItems | ForEach-Object {
# Get the items
$currentItem = $_
# Get item fields and create loop
$currentItem.Fields | ForEach-Object {
#Check the field type
if ($_.type -eq "General Link")
{
[Sitecore.Data.Fields.LinkField]$linkField = $currentItem.Fields[$_.name]
# Update target for Internal Links
if ($linkField.Linktype -eq 'internal')
{
$currentItem.Editing.BeginEdit()
$linkField.target = ""
$currentItem.Editing.EndEdit()
}
}
}
}
Hope this helps !
| How can I check all internal link target values from the entire content tree using Sitecore PowerShell?
Im writing a powershell script which at the moment is checking an item ID, and if it contains an internal link that is set to anything other then "Active Browser" it will change the Target to this value.
What I would like to do is go through each item in the entire content tree (/sitecore/content/sitename/Home) and also check each child item for all internal links. Again any that are set to "custom" or "Open in new browser" I would like to set the Target to "Active Browser"
Can anyone help with this?
Below is what I have so far
$item = Get-Item master: -ID "{BDC9773C-7329-4C22-9B87-DD74DC25ADAD}"
[Sitecore.Data.Fields.LinkField]$linkField = $item.Fields["insightsLink"]
Write-Host $item.Fields["insightsLink"]
$item.Editing.BeginEdit()
$linkField.Target = ""
$item.Editing.EndEdit()
Write-Host $item.Fields["insightsLink"]
Thank you!
| |
You can make the field mandatory and hide the submit button using the condition. That way you can ensure the user will not be able to go to the next page with empty message field value.
Follow the below steps to achieve your requirements.
Create a new Sitecore Form
Drag and Drop Page element from the Form element section.
Again drag and drop Page element and name it "ConfirmationPage"
Select the first page and prepare a form structure like below
Place Section and under the section add your field called Message as a Multiline line text field.
Change the label to Message.
If you want the Message filed as Mandatory you can mark it as mandatory.
Add another Section and then add Submit button to the section.
Click the Submit button and change the Lable and Field name as per your need. Now click the Edit conditions button and add the condition
Submit button:
Alos, you can control the Submit button to be displayed on Section level like if the Message field is Empty then Submit button is hidden and once the user interacts with it it will come up.
Hope it helps!
| Sitecore Form Condition to check field should not be empty
I am trying to check if the field is not empty then navigate to next page.
Please let me know how can we achieve using Sitecore Form condition.
Kindly refer to the image attached for reference.
| |
You can't set the default value for the Target drop down list, but you can change the order of its options, so that the "Active browser" appears at the top of the list.
Follow the below simple steps to change the sort order of the Target list in the Link Details form:
Switch to the Core DB in the Sitecore Desktop;
In the Content Editor, navigate to the /sitecore/client/Business Component Library/version 1/Templates/Common/Text folder and add a new field of the Single-Line Text type to store the sort order. For example, call it SortOrder;
Navigate to the /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog/PageSettings/Targets folder and set the sort order value for each target individually using 1, 2 and 3 values; make sure that 1 is set to the "Active browser" target option;
Navigate to the /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog/PageSettings/TargetsSearchPanelConfig item and set the value of the Sorting field to aSortOrder (should be "a" followed by the name of your Sort field from step 2).
Important to rebuild the sitecore_core_index index; go to the Control Panel > Index Manager and select the core index for rebuild.
| When inserting a link in Sitecore, how to make the Target to be "Active browser" by default?
At the moment when inserting an internal link in Sitecore, by default the Target is set to "Custom". Is there a way to manually change this within the Core database?
| |
I think it is possible that the old 'rebuild document' is still present on your primary core, from your previous failed attempt. Because of this, the process is failing to start, as it believes it is already in a started state.
To remove the document from Azure Search please try issuing a POST request to the following URI with the appropriate service name, index name and api admin key (as a header) filled in:
POST https://[service name].search.windows.net/indexes/[index name]/docs/index?api-version=2017-11-11
Content-Type: application/json
api-key: [admin key]
With the following request body:
{
"value": [
{
"@search.action": "delete",
"id": "xdb-rebuild-status"
}
]
}
Then try restarting the rebuild process.
Credit for the deleting azure document here: https://stackoverflow.com/questions/54339348/how-to-delete-specific-document-using-id-on-azure-search-rest-api
| Rebuilding of xDB index doesn't start after scaling up Azure Search
We have an issue with Sitecore xDB index in Azure Search on Sitecore 9.1.1.
Recently we tried to rebuild xDB index but we ran out of storage - 25GB was not enough to keep xDB index, secondary xDB index for rebuilding and default Sitecore indexes.
We scaled up Azure Search by adding one more partition - now we have 50GB.
We restarted xc-search app service and started rebuilding of xDB index again.
Secondary index was removed and recreated, logs in IndexWorker contain only standard message
[Information] Starting Xdb Indexer App Domain, Machine: DW1MDWK000006, InstanceName: XConnectIndexer_AppDomain
[Information] AppInsightsPerformanceCounters Constructor, Instance:XConnectIndexer, Path: App_Data\Diagnostics, CounterFilePattern: *.json
[Information] Done.
After 1 hour there was only 1 document in secondary index:
{"id": "indexconfiguration", "lastupdated": "2022-05-26T01:43:46.906Z" }.
There were no errors in xc-search logs and no errors in IndexWorker logs.
We restart xc-search app service again, executed .\XConnectSearchIndexer.exe -rr again and same story - secondary index removed and recreated, after few minutes 1 document in the index. Same as earlier. Nothing more.
We let IndexWorker to process over night but no change. 1 document in the index.
I tried again in the morning, same story. Index is being removed from Azure Search and new empty one is being created. But then, only 1 document is there after few minutes {"id": "indexconfiguration", "lastupdated": "2022-05-26T01:43:46.906Z", "isactivecore": false } and nothing more
When I run $filter=id eq 'xdb-rebuild-status'&$select=lastupdated,id,rebuildstate on primary index, I see:
{
"@search.score": 1,
"id": "xdb-rebuild-status",
"lastupdated": "2023-10-03T05:40:59.243Z",
"rebuildstate": 2
}
Last updated matches the time when I triggered rebuild in the morning, rebuildstate: 2 stands for starting.
Does anyone have any idea why IndexWorker does not rebuild xDB index after scaling up Azure Search?
| |
I faced similar problem while doing CLI setup in Sitecore 10.1. After discussing with Sitecore support, I removed the CLI plugins from my project and did the fresh CLI installation again. That fixed my problem.
You can also try this once.
| Could not locate plugin Sitecore.DevEx.Extensibility.Indexing@5.2.113. Some CLI commands may not function correctly
While implementing Sitecore Content Serialization using Sitecore Cli, getting this error:
"Could not locate plugin Sitecore.DevEx.Extensibility.Serialization@5.2.113. Some CLI commands may not function correctly."
"Could not locate plugin Sitecore.DevEx.Extensibility.Indexing@5.2.113. Some CLI commands may not function correctly."
"Could not locate plugin Sitecore.DevEx.Extensibility.ResourcePackage@5.2.113. Some CLI commands may not function correctly."
"Could not locate plugin Sitecore.DevEx.Extensibility.Database@5.2.113. Some CLI commands may not function correctly."
I have checked and updated the version of plugins using the following commands to 5.2.113:
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Serialization --version {version}
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Publishing --version {version}
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Indexing --version {version}
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.ResourcePackage --version {version}
but still getting this error message in powershell terminal.
I am unable to find the reason why Sitecore CLI keep complaining that a plugin can't be located when it is infact installed in "..\Serialization\.sitecore\package-cache\nuget" folder.
| |
Please check the followings-
Your certificate is both valid and accessible to the xConnect application.
Solr is error-free.
Kindly verify that you have created and deployed the custom model in accordance with the recommended link below -
https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-platform/deploy-a-custom-model.html
Ensure that the custom model has been deployed under the Index Manager job within xConnect, and remember to restart the job afterward.
| Experience Analytics Data Is Not Coming
As checked in experience profile, the analytics data is not loading up from last 1-2 months.
Upon checking the xconnect logs we found below exception message:
7180 00:00:31 ERROR Cannot execute 'sessionEnd:batch:ended' event
Exception: System.AggregateException Message: One or more exceptions
occurred while processing the subscribers to the
'sessionEnd:batch:ended' event. Source: Sitecore.Kernel at
Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName,
Object[] parameters, EventResult result) at
Sitecore.Events.Event.RaiseEvent(String eventName, Object[]
parameters) at
Sitecore.Kernel.Web.SessionExpirationProcessor.TryRaiseEvent(String
eventName, Object[] parameters)
Nested Exception
**Exception: Sitecore.XConnect.XdbCollectionUnavailableException**
**Message: { "Message": "Operation failed: The type initializer for
'AllowedTypesValidatorSerializationBinder' threw an exception." }**
Source: Sitecore.XConnect.Client at
Sitecore.XConnect.Client.XConnectSynchronousExtensions.SuspendContextLock(Func`1
taskFactory) at
Sitecore.Analytics.XConnect.DataAccess.BatchedXdbContextProxy.SubmitBatch()
at
Sitecore.Analytics.XConnect.DataAccess.BatchEnabledXdbRuntimeContext.SubmitBatch()
at Sitecore.Analytics.Events.BatchEventHandler.OnBatchEnded(Object
sender, EventArgs args) at
Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName,
Object[] parameters, EventResult result)
Earlier we faced issues regarding the Device Detection but now we have checked, it seems to be working fine.
So any idea about this issue?
| |
You can add just roles to Sitecore TDS, Sitecore users are not supported AFAIK.
| Can we add sitecore users to TDS?
Is there a way to add users to sitecore TDS?
I'm using version 6.0.0.18.
Thanks in advance
| |
@Anna Gauvel correctly pointed out that these paths were relics from a legacy CMS.
The learnings are:
Monitor your error logs for errors such as System.ArgumentException Sitecore.Web.XFrameOptionsHeaderModule in IsSitecoreFolderRequest - illegal characters in path
Analyze those requests' referrer header to see where the requests might be coming from
Some of the requests may be originating from your own site, which calls for one or more of the following actions:
Better data cleanup detection / controls when migrating content
Ongoing content scanning / cleanup
Content entry training (especially when pasting in rich text fields, which is a perennial problem)
Setting up redirects
Performing regular broken link checking
| System.ArgumentException Sitecore.Web.XFrameOptionsHeaderModule in IsSitecoreFolderRequest
In my error logs, I often see the error:
System.ArgumentException Sitecore.Web.XFrameOptionsHeaderModule in IsSitecoreFolderRequest
The request paths seem to always contain OpenAccessDataProvider. For example:
/news/2019/07/[documents|OpenAccessDataProvider]0590292e-7308-60d3-8844-ff00003e4f20
The referrer request header always seems to originate from a legitimate path (page) on my site; in fact, the URLs were added by content authors in a rich text field.
What are these requests, and how should I handle them?
| |
NameValueList Field, stores value in the form of querystring which gets delivered as it is in layout service. So, in order to get the data in a more meaningful structure you can customize the Field Serializer for NameValueField.
The first step is to create a custom serializer by inheriting Sitecore.LayoutService.Serialization.FieldSerializers.BaseFieldSerializer and overriding WriteValue Method:
public class NameValueListSerializer : BaseFieldSerializer
{
public NameValueListSerializer(IFieldRenderer fieldRenderer) : base(fieldRenderer)
{
}
protected override void WriteValue(Field field, JsonTextWriter writer)
{
Assert.ArgumentNotNull((object)field, nameof(field));
Assert.ArgumentNotNull((object)writer, nameof(writer));
try
{
writer.WriteStartObject();
string range = field.Value;
if (!string.IsNullOrEmpty(range))
{
string[] ranges = range.Split('&');
if (ranges != null)
{
foreach (string dropdownpair in ranges)
{
string[] pair = dropdownpair.Split('=');
writer.WritePropertyName(pair[0]);
writer.WriteValue(HttpUtility.UrlDecode(pair[1]));
}
}
}
writer.WriteEndObject();
}
catch (Exception ex)
{
Sitecore.Diagnostics.Log.Error(ex.Message, typeof(NameValueListSerializer));
}
}
}
Now, implement the class by inheriting Sitecore.LayoutService.Serialization.Pipelines.GetFieldSerializer.BaseGetFieldSerializer and overriding SetResult Method:
public class GetNameValueListSerializer : BaseGetFieldSerializer
{
public GetNameValueListSerializer(IFieldRenderer fieldRenderer) : base(fieldRenderer)
{
}
protected override void SetResult(GetFieldSerializerPipelineArgs args)
{
args.Result = (IFieldSerializer)new NameValueListSerializer(this.FieldRenderer);
}
}
Now, the last step is to patch our custom resolver and we need to make sure that we patch it before GetDefaultFieldSerializer processor:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<group groupName="layoutService">
<pipelines>
<getFieldSerializer>
<processor patch:before="processor[@type='Sitecore.LayoutService.Serialization.Pipelines.GetFieldSerializer.GetDefaultFieldSerializer, Sitecore.LayoutService']" type="Sandbox.GetNameValueListSerializer, Sandbox" resolve="true">
<FieldTypes hint="list">
<fieldType id="1">name value list</fieldType>
</FieldTypes>
</processor>
</getFieldSerializer>
</pipelines>
</group>
</pipelines>
</sitecore>
</configuration>
Now, instead of the querystring we will get the object of key-value pairs.
Credit: https://gauravarorasb.medium.com/sitecore-headless-services-custom-field-serializer-for-namevaluelist-field-da2b51280cd7
Hope it helps!
| NameValueList in JSS to field type
I'm building a GraphQL query to return back an item and its fields. One field is NameValueList - I can just return it as a string and cast it to an interface
the layout service returns it like this:
"myNameValueList": {
"value": "key1=1&key2=0"
}
My interface looks like this:
interface MyFields {
id: string
name: string
myNameValueList: string
}
Is there a way I can return it that's not like a query parameter? is there a way I can use nextjs field to map this instead of a string? so it ends up being something like:
interface MyFields {
id: string
name: string
myNameValueList: { [key: string]: string }
}
Thanks in advance
| |
You just need to reorder regex parts like that:
{"regularExpression":"^((18|19|20)[0-9]{2}[/](0[13578]|1[02])[/]31)|((18|19|20)[0-9]{2}[/](01|0[3-9]|1[1-2])[/](29|30))|((18|19|20)[0-9]{2}[/](0[1-9]|1[0-2])[/](0[1-9]|1[0-9]|2[0-8]))|((((18|19|20)(04|08|[2468][048]|[13579][26]))|2000)[/](02)[/]29)$"}
Now year goes first, then month and then day.
| Validate Date entered is in yyyy/mm/dd format in Sitecore Forms
I have a text field in the Sitecore form where the user needs to enter a Date.
Currently, I am using Regex Validator that check date in mm/dd/yyyy format.
Need support to check if the date is in yyyy/mm/dd format.
{"regularExpression":"^((0[13578]|1[02])[/]31[/](18|19|20)[0-9]{2})|((01|0[3-9]|1[1-2])[/](29|30)[/](18|19|20)[0-9]{2})|((0[1-9]|1[0-2])[/](0[1-9]|1[0-9]|2[0-8])[/](18|19|20)[0-9]{2})|((02)[/]29[/](((18|19|20)(04|08|[2468][048]|[13579][26]))|2000))$"}
The above regex I am currently using.
| |
I think a custom submit action might be needed. All information on how to do that can be found in the official docs: https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/walkthrough--creating-a-custom-submit-action.html. I will assume it is not worth copying that here.
Could be a bit tricky to find a way to define the page to redirect to across all the sites - but that is actually more a functional question and will rely on your content structure.
As an example, this is what the ootb redirect to page looks like (or at least the execure function):
protected override bool Execute(RedirectActionData data, FormSubmitContext formSubmitContext)
{
if (data != null && data.ReferenceId != Guid.Empty)
{
Item obj = Context.Database.GetItem(new ID(data.ReferenceId));
if (obj == null)
{
return false;
}
ItemUrlBuilderOptions urlBuilderOptions = this.LinkManager.GetDefaultUrlBuilderOptions();
urlBuilderOptions.SiteResolving = new bool?(Settings.Rendering.SiteResolving);
formSubmitContext.RedirectUrl = new UrlString(this.LinkManager.GetItemUrl(obj, urlBuilderOptions)).ToString();
formSubmitContext.RedirectOnSuccess = true;
formSubmitContext.Abort();
return true;
}
return false;
}
| Customizing Redirect to Page Action to redirect to specific site success page
I have a Sitecore Form in which post submission it redirects to success page so now we want Single Form to be used for Multisite structure in Sitecore.
Currently Sitecore Forms provides only one page to configure for Redirect to Page action method.
Is there a way to customize Redirect to Page/Redirect to Url action method to be able configure multiple success page and based on current domain redirect to configured success page of specific site?
Please let me know alternate solutions if any.
Thankyou.
| |
You will notice some new files in your solution folder after the CLI installation process β e.g. .scindex files, .sitecore/ folder. These can be added to .gitignore.
If you run into issues with your serialization after doing this, try running:
dotnet tool restore
The dotnet tool restore command will find the tool manifest file that is in scope for the current directory and install back the tools that are listed in it.
Note: Make sure not to commit the .sitecore\user.json file to source control as it contains privileged information.
Hope it helps!
| Should .sitecore folder get comitted to source control
Im developing my first Sitecore 10 site. I have installed the Sitecore CLI. This creates a folder in my project '.sitecore' with my CLI configuration, etc... Does this folder get committed to source control? Or is this entirely unique to each user?
| |
That's expected behavior.
When you call client.MergeContacts it will copy facets from Source contact to Target Contact, but it will not merge any facets.
ExmKeyBehaviorCache facet contains a list of MarketingPreference objects. When you merge, it will just copy the whole ExmKeyBehaviorCache facet. It will not merge lists of marketing preferences from ExmKeyBehaviorCache source contact facet with ExmKeyBehaviorCache target contact facet.
EDIT
Here is the information from Sitecore documentation ( https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-platform/merge-contacts.html ):
All value facets are copied from the source contact to the target contact except when the facet already exists on the target contact. For example, if the target contact already has PersonalInformation facet, it will not be overridden by the source contactβs PersonalInformation facet.
Note
Experience Optimizationβs TestCombinations facet behaves differently - if an anonymous contact was exposed to a test combination and then identifies themselves partway through the session, the known contactβs test combinations facet will be overwritten.
Calculated facet merge handlers are executed.
And another part:
Custom merge handlers
You must create a calculated facet merge handler for calculated facets, as they may required custom merge logic. Value facets are merged automatically. However, you can create a merge handler for a value facet if that facet requires custom merge logic.
https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-platform/create-a-facet-merge-handler.html
| xConnect MergeContacts operation does not copy the facet data to Target Contact
Request your support.
I have two contacts with same email id and different source identifier. I want to perform mergeContacts() operation on these two contacts. I am using standard xConnect API.
client.MergeContacts(SourceContact, TargetContact);
I see merge operation is getting successful but I don't see facet data is copied from SourceContact to TargetContact.
Source & Target contact has one marketing preference each. I am expecting two marketing preferences on Target contact once merge get succeeded.
Thanks
Hari
| |
The possible case can be creating a custom field. You can create a custom field that will be a copy of a hidden field and here you can get the rendering parameters and assign it to the hidden field.
So your view will be something like this.
@using System.Web.Mvc.Html
@model Site.Feature.Forms.Forms.Controls.HiddenField.HiddenFieldModel
{
var parms = renderingContext.Rendering.Parameters;
var renderingParamValue = parms["name of the field here"];
}
<input type="hidden" id="@Html.IdFor(m => Model.Value)" name="@Html.NameFor(m => Model.Value)" value="@renderingParamValue" />
In this way you can assign the rendering parameter value to the hidden field and you will get it to your custom submit action.
For more information about creating custom hidden field refer to this
Hope this helps.
| Sitecore Forms - Possibility of reading MVC FORM Rendering parameter in Custom Submit Action
I have one Sitecore Form to be used across multiple sites for which I want to configure respective thankyou pages (route might be different for individual site) at rendering parameter. So Is there a possibility of reading Mvc Form Rendering parameter value in Custom Submit Action method or any alternative to achieve ?
Because in Custom Submit Action while reading rendering parameter is always Null. RenderingContext.Current.Rendering.Parameters["RedirectUrl"]
Thankyou.
| |
In my case after installing the Content Hub connector package the web.config was modified to refer to the 3.1.14.0 version of the Microsoft dependency injection DLLs but I changed the version back to the original 6.0.0.0 as following in the web.config
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
<codeBase version="6.0.0.0" href="bin/scch/Microsoft.Extensions.DependencyInjection.Abstractions.dll"/>
</dependentAssembly>
And checked that the version of the DI DLLs is 6.0.0.0 now everything works fine.
UPDATE-1: After 4 months again I tried to set up the same scenario and got the same issue but this time a strange thing happened to fix this.
I added the new entry as shown in the red box, above the commented line then it worked but, after doing the web.config and connectionstring.config changes, again got the same issue. Now this time added the entry of the commented line and added the respective version's dll in the bin/scch folder and commented the previous line and un-commented the newly added commented line, and it again started working.
Whenever I make changes in the configs then yellow screens come and I have to do vice-versa by commenting the uncommented line and un-commenting the commented line with the dll file, of the specific version, update.
| On-prem deployment throws Method implementation missing error in Microsoft.Extensions.DependencyInjection or DisposeAsync method error
I installed the Sitecore Connect for Content Hub 5.1 with Sitecore 10.3 XM. After installing the WDP package of CH in Sitecore and making the configuration changes in the connection string for DAM.ContentHub and DAM.SearchPage I get the following error:
I went through the link https://doc.sitecore.com/xp/en/developers/connect-for-ch/50/connect-for-content-hub/troubleshooting-scch.html where it is suggested for installing the 3.1.14 version of the Microsoft dependency injection with Sitecore.Kernel of version 13.0.0-r* by creating a new Class Library project and then deploy that class library in the bin of your Sitecore instance with the config patch as suggested in the Sitecore page, available on the link pasted.
Now my query is that, since my Sitecore instance is at 10.3, ideally I will have to refer to 10.3's Sitecore.kernel Dll in the class library project, which I checked is of 18.0.0 version. Now, I can't install the 3.1.14 version of the MS Dependency injection because Sitecore.kernel.dll version 18.0.0 uses 6.0.0 version of MS Dependency. If I degrade sitecore.kernel.dll to 13.0.0 to use 3.1.14 of MS dependency then my project will not run because it is based on 10.3 XM (i.e., 18.0.0 of sitecore.kernel.dll). Hence, it contradicts the solution provided by Sitecore.
So, do you have any other solution to tackle this DisposeAsync issue with Sitecore 10.3 XM and CH 5.1?
| |
The problem was in the Sitecore server.bundle.ts file. In previous versions of Angular there was:
module.exports = {...}
In the new version, now it's just:
export {...}
-Judson
| After upgrading to angular 15 sitecore experience editor is throwing error: ES Modules may not assign module.exports or exports
We have recently upgraded to Angular 15 for Sitecore. Everything works fine except for the Experience Editor. We are getting the following. I am suspicious that Sitecore is not fully ready for Angular 15? Thanks in advance.
Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: ES Modules may not assign module.exports or exports.*,
Use ESM export syntax, instead: 99534 Error: ES Modules may not assign module.exports or exports.*,
Use ESM export syntax, instead: 99534
at Object.set [as exports] (C:\inetpub\wwwroot\dist\EmployerAdminPortal\server.bundle.js:14:6392553)
at 99534 (C:\inetpub\wwwroot\dist\EmployerAdminPortal\server.bundle.js:14:2878721)
at __webpack_require__ (C:\inetpub\wwwroot\dist\EmployerAdminPortal\server.bundle.js:14:6391825)
at C:\inetpub\wwwroot\dist\EmployerAdminPortal\server.bundle.js:14:6393006
at Object. (C:\inetpub\wwwroot\dist\EmployerAdminPortal\server.bundle.js:14:6393258)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.Http.HttpNodeInstance.InvokeExport[T](NodeInvocationInfo invocationInfo)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.OutOfProcessNodeInstance.InvokeExport[T](String moduleName, String exportNameOrNull, Object[] args)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.DefaultNodeServices.InvokeExportWithPossibleRetry[T](String moduleName, String exportedFunctionName, Object[] args, Boolean allowRetry)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.DefaultNodeServices.InvokeExport[T](String moduleName, String exportedFunctionName, Object[] args)
at Sitecore.JavaScriptServices.ViewEngine.Node.NodeRenderEngine.Invoke[T](String moduleName, String functionName, Object[] functionArgs)
at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.PerformRender(TextWriter writer, IRenderEngine renderEngine, String moduleName, String functionName, Object[] functionArgs)
at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
| |
I see a potential issue with your $SCTemplates parameter value, You need to change the template path to pass a valid template path. Follow below sptes to get the correct template path.
Go to Sitecore 9.3 XPSingle github link and click on azuredeploy.parameters.json (here)
Click on the Raw button.
Copy the full url and set $SCTemplates="https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%209.3.0/XPSingle"
Also, If you downloaded the Sitecore Azure Toolkit as a .ZIP and unzip it, the individual files will be marked as blocked files. if they are all blocked your Powershell script won't work.
Before unzipping, right click the zip file, go to security and select the Unblock button on the .ZIP file, then extract.
Reference: https://navansitecorenotes.blogspot.com/2020/08/sitecore-xp-10-xm0-deployment-using-sat.html
Script reference: https://raw.githubusercontent.com/navancommits/sitecore10/master/xm0%20dep%20ps%20script.ps1
Hope it helps!
| Facing issue while deploying Sitecore 9.3 to Azure app service
I am using Sitecore Azure Toolkit 2.5 and template https://github.com/Sitecore/Sitecore-Azure-Quickstart-Templates/blob/master/Sitecore%209.3.0/XPSingle/azuredeploy.json
Here are my scripts besides all parameter files
$SCSDK="F:\sitecore\azure\SAT250"
$SCTemplates="https://github.com/Sitecore/Sitecore-Azure-Quickstart-Templates/tree/master/Sitecore%209.3.0/XPSingle/azuredeploy.json"
$DeploymentId = "sandstorm"
$LicenseFile = "C:\sc930_install\license.xml"
$SubscriptionId = "<subscriptionid>"
$Location="South Central US"
$ParamFile="F:\sitecore\azure\XPSingle\azuredeploy.parameters.json"
$ArmTemplatePath = "F:\sitecore\azure\XPSingle\azuredeploy.json"
$CertificateFile = "C:\certificates\star.demo789.pfx"
$Parameters = @{
#set the size of all recommended instance sizes
#"sitecoreSKU"="Medium";
"deploymentId"=$DeploymentId;
"authCertificateBlob" = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($CertificateFile));
#by default this installs azuresearch
#if you uncomment the following it will use an existing solr connectionstring that
# you have created instead of using AzureSearch
#"solrConnectionString"= "https://myinstancesomewhere/solr";
}
Import-Module $SCSDK\tools\Sitecore.Cloud.Cmdlets.psm1 -Verbose
Connect-AzAccount -tenantid <tenantid>
Set-AzContext -SubscriptionId $SubscriptionId
Start-SitecoreAzureDeployment -Verbose -Name $DeploymentId -Location $Location -ArmTemplateUrl $SCTemplates -ArmParametersPath $ParamFile -LicenseXmlPath $LicenseFile -SetKeyValue $Parameters
Unfortunately, I always got the following error:
New-AzResourceGroupDeployment : 5:13:53 AM - Error: Code=InvalidTemplate; Message=Deployment template parse failed: 'Unexpected character encountered
while parsing value: <. Path '', line 0, position 0.'.
At F:\sitecore\azure\SAT250\tools\Sitecore.Cloud.Cmdlets.psm1:115 char:35
+ ... eployment = New-AzResourceGroupDeployment -Name $Name -ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzResourceGroupDeployment : The deployment validation failed
At F:\sitecore\azure\SAT250\tools\Sitecore.Cloud.Cmdlets.psm1:115 char:35
+ ... eployment = New-AzResourceGroupDeployment -Name $Name -ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzResourceGroupDeployment], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
Any help is appreciated!
The template validation passed after making changes to the url of the template path to https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%209.3.0/XPSingle/azuredeploy.json
The certificate is a wildcard certificate *.demo789.com and I verified the the password can successfully import the pfx into local computer cert store. but the deployment script show the following errors now (but many resources are created in the resource group):
New-AzResourceGroupDeployment : 2:55:26 PM - The deployment 'sandstorm' failed with error(s). Showing 2 out of 2 error(s).
Status Message: At least one certificate is not valid (Certificate failed validation because it could not be loaded). (Code: BadRequest)
- At least one certificate is not valid (Certificate failed validation because it could not be loaded). (Code:)
- (Code:BadRequest)
- (Code:)
Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see
https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)
- {
"Code": "BadRequest",
"Message": "At least one certificate is not valid (Certificate failed validation because it could not be loaded).",
"Target": null,
"Details": [
{
"Message": "At least one certificate is not valid (Certificate failed validation because it could not be loaded)."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "04023",
"MessageTemplate": "At least one certificate is not valid ({0}).",
"Parameters": [
"Certificate failed validation because it could not be loaded"
],
"Code": "BadRequest",
"Message": "At least one certificate is not valid (Certificate failed validation because it could not be loaded)."
}
}
],
"Innererror": null
} (Code:BadRequest)
CorrelationId: c54130dc-0b88-4058-8844-a6d94d74dd8f
At F:\sitecore\azure\SAT250\tools\Sitecore.Cloud.Cmdlets.psm1:115 char:35
+ ... eployment = New-AzResourceGroupDeployment -Name $Name -ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
DeploymentName : sandstorm
ResourceGroupName : sandstorm
ProvisioningState : Failed
Timestamp : 10/12/2023 2:55:25 PM
Mode : Incremental
TemplateLink :
Uri : https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%209.3.0/XPSi
ngle/azuredeploy.json
ContentVersion : 1.0.0.0
Parameters :
Name Type Value
==================================================================== ========================= ==========
modules SecureObject null
...
the certificate issue is gone after using a self-signed certificate but now there is a sql server timeout error - I will try it again
New-AzResourceGroupDeployment : 3:51:46 PM - The deployment 'sandstorm' failed with error(s). Showing 1 out of 1 error(s).
Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see
https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)
- {
"status": "failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'failed'.",
"details": [
{
"code": "Failed",
"message": "Package deployment failed\r\nARM-MSDeploy Deploy Failed: 'Microsoft.Web.Deployment.DeploymentDetailedClientServerException: An
error occurred during execution of the database script. The error occurred between the following lines of the script: \"1\" and \"8\". The verbose
log might have more information about the error. The command started with the following:\r\n\"DECLARE @sqlCommand nvarchar(1000)=''\"\r\n ODBC error:
State: 08001: Error: 258 Message:'[Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Timeout error [258]. '.\r\nALTER DATABASE statement failed.
http://go.microsoft.com/fwlink/?LinkId=178587 Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SQL_EXECUTION_FAILURE. ---&gt;
System.Data.SqlClient.SqlException: ODBC error: State: 08001: Error: 258 Message:'[Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Timeout
error [258]. '.\r\nALTER DATABASE statement failed.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean
breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean
callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler,
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean&amp; dataReady)\r\n at
System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)\r\n at
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout,
Boolean&amp; usedCache, Boolean asyncWrite, Boolean inRetry)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at
Microsoft.Web.Deployment.DBStatementInfo.Execute(DbConnection connection, DbTransaction transaction, DeploymentBaseContext baseContext, Int32
timeout)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Web.Deployment.DBStatementInfo.Execute(DbConnection connection,
DbTransaction transaction, DeploymentBaseContext baseContext, Int32 timeout)\r\n at
Microsoft.Web.Deployment.DBConnectionWrapper.ExecuteSql(DBStatementInfo sqlStatement, DeploymentBaseContext baseContext, Int32 timeout)\r\n at
Microsoft.Web.Deployment.SqlScriptToDBProvider.AddHelper(DeploymentObject source, Boolean whatIf)\r\n at
Microsoft.Web.Deployment.DeploymentObject.AddChild(DeploymentObject source, Int32 position, DeploymentSyncContext syncContext)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.HandleAddChild(DeploymentObject destParent, DeploymentObject sourceObject, Int32 position)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)\r\n at
Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable,
ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId)\r\n at
Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions
syncOptions)\r\n at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.Deploy(String deploymentSite, String siteSlotId, Boolean doNotDelete) in
C:\\__w\\1\\s\\src\\hosting\\wdeploy\\Microsoft.Web.Deployment.WebApi\\AppGalleryPackage.cs:line 343\r\n at
Microsoft.Web.Deployment.WebApi.DeploymentController.&lt;DownloadAndDeployPackage&gt;d__25.MoveNext() in
C:\\__w\\1\\s\\src\\hosting\\wdeploy\\Microsoft.Web.Deployment.WebApi\\Controllers\\DeploymentController.cs:line 505'"
}
]
}
} (Code:Conflict)
CorrelationId: 9567582c-8a07-43dc-81c3-a316f63428a4
At F:\sitecore\azure\SAT250\tools\Sitecore.Cloud.Cmdlets.psm1:115 char:35
+ ... eployment = New-AzResourceGroupDeployment -Name $Name -ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
more sql errors:
New-AzResourceGroupDeployment : 4:13:42 PM - The deployment 'sandstorm' failed with error(s). Showing 2 out of 2 error(s).
Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see
https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)
- {
"status": "failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'failed'.",
"details": [
{
"code": "Failed",
"message": ".Net SqlClient Data Provider: Msg 22115, Level 16, State 1, Line 5 Change tracking is enabled for one or more tables in database
'sandstorm-shard0-db'. Disable change tracking on each table before disabling it for the database. Use the sys.change_tracking_tables catalog view to
obtain a list of tables for which change tracking is enabled.\r\n.Net SqlClient Data Provider: Msg 22115, Level 16, State 1, Line 5 Change tracking
is enabled for one or more tables in database 'sandstorm-shard0-db'. Disable change tracking on each table before disabling it for the database. Use
the sys.change_tracking_tables catalog view to obtain a list of tables for which change tracking is enabled.\r\nScript execution error. The executed
script:\r\nIF EXISTS (SELECT 1\r\n FROM [sys].[databases]\r\n WHERE [name] = N'$(DatabaseName)')\r\n BEGIN\r\n ALTER
DATABASE [$(DatabaseName)]\r\n SET CHANGE_TRACKING = OFF \r\n WITH ROLLBACK IMMEDIATE;\r\n END\r\n\r\n\r\nScript execution
error. The executed script:\r\nIF EXISTS (SELECT 1\r\n FROM [sys].[databases]\r\n WHERE [name] = N'$(DatabaseName)')\r\n
BEGIN\r\n ALTER DATABASE [$(DatabaseName)]\r\n SET CHANGE_TRACKING = OFF \r\n WITH ROLLBACK IMMEDIATE;\r\n
END\r\n\r\n\r\n.Net SqlClient Data Provider: Msg 5069, Level 16, State 1, Line 5 ALTER DATABASE statement failed.\r\n.Net SqlClient Data Provider:
Msg 5069, Level 16, State 1, Line 5 ALTER DATABASE statement failed.\r\nScript execution error. The executed script:\r\nIF EXISTS (SELECT 1\r\n
FROM [sys].[databases]\r\n WHERE [name] = N'$(DatabaseName)')\r\n BEGIN\r\n ALTER DATABASE [$(DatabaseName)]\r\n
SET CHANGE_TRACKING = OFF \r\n WITH ROLLBACK IMMEDIATE;\r\n END\r\n\r\n\r\nScript execution error. The executed script:\r\nIF EXISTS
(SELECT 1\r\n FROM [sys].[databases]\r\n WHERE [name] = N'$(DatabaseName)')\r\n BEGIN\r\n ALTER DATABASE
[$(DatabaseName)]\r\n SET CHANGE_TRACKING = OFF \r\n WITH ROLLBACK IMMEDIATE;\r\n END\r\n\r\n\r\nPackage deployment
failed\r\nARM-MSDeploy Deploy Failed: 'Microsoft.Web.Deployment.DeploymentDetailedClientServerException: Could not deploy package.\r\nWarning
SQL72030: If this deployment is executed, changes to [xdb_collection].[ContactFacets] might introduce run-time errors in
[xdb_collection].[GetContactFacetsChanges].\r\nWarning SQL72030: If this deployment is executed, changes to [xdb_collection].[Contacts] might
introduce run-time errors in [xdb_collection].[GetContactsChanges].\r\nWarning SQL72030: If this deployment is executed, changes to
[xdb_collection].[InteractionFacets] might introduce run-time errors in [xdb_collection].[GetInteractionFacetsChanges].\r\nWarning SQL72030: If this
deployment is executed, changes to [xdb_collection].[Interactions] might introduce run-time errors in
[xdb_collection].[GetInteractionsChanges].\r\nError SQL72014: .Net SqlClient Data Provider: Msg 22115, Level 16, State 1, Line 5 Change tracking is
enabled for one or more tables in database 'sandstorm-shard0-db'. Disable change tracking on each table before disabling it for the database. Use the
sys.change_tracking_tables catalog view to obtain a list of tables for which change tracking is enabled.\r\nError SQL72045: Script execution error.
The executed script:\r\nIF EXISTS (SELECT 1\r\n FROM [sys].[databases]\r\n WHERE [name] = N'$(DatabaseName)')\r\n BEGIN\r\n
ALTER DATABASE [$(DatabaseName)]\r\n SET CHANGE_TRACKING = OFF \r\n WITH ROLLBACK IMMEDIATE;\r\n END\r\n\r\n\r\nError
SQL72014: .Net SqlClient Data Provider: Msg 5069, Level 16, State 1, Line 5 ALTER DATABASE statement failed.\r\nError SQL72045: Script execution
error. The executed script:\r\nIF EXISTS (SELECT 1\r\n FROM [sys].[databases]\r\n WHERE [name] = N'$(DatabaseName)')\r\n
BEGIN\r\n ALTER DATABASE [$(DatabaseName)]\r\n SET CHANGE_TRACKING = OFF \r\n WITH ROLLBACK IMMEDIATE;\r\n
END\r\n\r\n\r\n\r\n Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD. ---&gt;
Microsoft.SqlServer.Dac.DacServicesException: Could not deploy package.\r\nWarning SQL72030: If this deployment is executed, changes to
[xdb_collection].[ContactFacets] might introduce run-time errors in [xdb_collection].[GetContactFacetsChanges].\r\nWarning SQL72030: If this
deployment is executed, changes to [xdb_collection].[Contacts] might introduce run-time errors in [xdb_collection].[GetContactsChanges].\r\nWarning
SQL72030: If this deployment is executed, changes to [xdb_collection].[InteractionFacets] might introduce run-time errors in
[xdb_collection].[GetInteractionFacetsChanges].\r\nWarning SQL72030: If this deployment is executed, changes to [xdb_collection].[Interactions] might
introduce run-time errors in [xdb_collection].[GetInteractionsChanges].\r\nError SQL72014: .Net SqlClient Data Provider: Msg 22115, Level 16, State
1, Line 5 Change tracking is enabled for one or more tables in database 'sandstorm-shard0-db'. Disable change tracking on each table before disabling
it for the database. Use the sys.change_tracking_tables catalog view to obtain a list of tables for which change tracking is enabled.\r\nError
SQL72045: Script execution error. The executed script:\r\nIF EXISTS (SELECT 1\r\n FROM [sys].[databases]\r\n WHERE [name] =
N'$(DatabaseName)')\r\n BEGIN\r\n ALTER DATABASE [$(DatabaseName)]\r\n SET CHANGE_TRACKING = OFF \r\n WITH ROLLBACK
IMMEDIATE;\r\n END\r\n\r\n\r\nError SQL72014: .Net SqlClient Data Provider: Msg 5069, Level 16, State 1, Line 5 ALTER DATABASE statement
failed.\r\nError SQL72045: Script execution error. The executed script:\r\nIF EXISTS (SELECT 1\r\n FROM [sys].[databases]\r\n
WHERE [name] = N'$(DatabaseName)')\r\n BEGIN\r\n ALTER DATABASE [$(DatabaseName)]\r\n SET CHANGE_TRACKING = OFF \r\n
WITH ROLLBACK IMMEDIATE;\r\n END\r\n\r\n\r\n\r\n at Microsoft.SqlServer.Dac.DeployOperation.ThrowIfErrorManagerHasErrors()\r\n at
Microsoft.SqlServer.Dac.DeployOperation.&lt;&gt;c__DisplayClass14.&lt;&gt;c__DisplayClass16.&lt;CreatePlanExecutionOperation&gt;b__13()\r\n at
Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(Action action)\r\n at
Microsoft.SqlServer.Dac.DeployOperation.&lt;&gt;c__DisplayClass14.&lt;CreatePlanExecutionOperation&gt;b__12(Object operation, CancellationToken
token)\r\n at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)\r\n at
Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)\r\n at
Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)\r\n at
Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken)\r\n
at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions
options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action`3 reportPlanOperation, Boolean executePlan)\r\n at
Microsoft.SqlServer.Dac.DacServices.Deploy(DacPackage package, String targetDatabaseName, Boolean upgradeExisting, DacDeployOptions options,
Nullable`1 cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at
Microsoft.Web.Deployment.SqlReflectionHelper.ExecuteFunction(Object targetObject, String methodName, Object[] argArray)\r\n at
Microsoft.Web.Deployment.DacServices.ProcessDacpac(Stream packageStream, DacPacAction action)\r\n at
Microsoft.Web.Deployment.SqlDacPacProvider.Add(DeploymentObject source, Boolean whatIf)\r\n at
Microsoft.Web.Deployment.DeploymentObject.Add(DeploymentObject source, DeploymentSyncContext syncContext)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.HandleAdd(DeploymentObject destObject, DeploymentObject sourceObject)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildren(DeploymentObject dest, DeploymentObject source)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)\r\n at
Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)\r\n at
Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable,
ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId)\r\n at
Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions
syncOptions)\r\n at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.Deploy(String deploymentSite, String siteSlotId, Boolean doNotDelete) in
C:\\__w\\1\\s\\src\\hosting\\wdeploy\\Microsoft.Web.Deployment.WebApi\\AppGalleryPackage.cs:line 343\r\n at
Microsoft.Web.Deployment.WebApi.DeploymentController.&lt;DownloadAndDeployPackage&gt;d__25.MoveNext() in
C:\\__w\\1\\s\\src\\hosting\\wdeploy\\Microsoft.Web.Deployment.WebApi\\Controllers\\DeploymentController.cs:line 495'"
}
]
}
} (Code:Conflict)
Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see
https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)
- {
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.",
"details": [
{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see
https://aka.ms/arm-deployment-operations for usage details.",
"details": [
{
"code": "Conflict",
"message": "{\r\n \"status\": \"failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The
resource write operation failed to complete successfully, because it reached terminal provisioning state 'failed'.\",\r\n \"details\": [\r\n
{\r\n \"code\": \"Failed\",\r\n \"message\": \".Net SqlClient Data Provider: Msg 22115, Level 16, State 1, Line 5 Change tracking is
enabled for one or more tables in database 'sandstorm-shard0-db'. Disable change tracking on each table before disabling it for the database. Use the
sys.change_tracking_tables catalog view to obtain a list of tables for which change tracking is enabled.\\r\\n.Net SqlClient Data Provider: Msg
22115, Level 16, State 1, Line 5 Change tracking is enabled for one or more tables in database 'sandstorm-shard0-db'. Disable change tracking on each
table before disabling it for the database. Use the sys.change_tracking_tables catalog view to obtain a list of tables for which change tracking is
enabled.\\r\\nScript execution error. The executed script:\\r\\nIF EXISTS (SELECT 1\\r\\n FROM [sys].[databases]\\r\\n WHERE
[name] = N'$(DatabaseName)')\\r\\n BEGIN\\r\\n ALTER DATABASE [$(DatabaseName)]\\r\\n SET CHANGE_TRACKING = OFF \\r\\n
WITH ROLLBACK IMMEDIATE;\\r\\n END\\r\\n\\r\\n\\r\\nScript execution error. The executed script:\\r\\nIF EXISTS (SELECT 1\\r\\n FROM
[sys].[databases]\\r\\n WHERE [name] = N'$(DatabaseName)')\\r\\n BEGIN\\r\\n ALTER DATABASE [$(DatabaseName)]\\r\\n
SET CHANGE_TRACKING = OFF \\r\\n WITH ROLLBACK IMMEDIATE;\\r\\n END\\r\\n\\r\\n\\r\\n.Net SqlClient Data Provider: Msg 5069, Level 16,
State 1, Line 5 ALTER DATABASE statement failed.\\r\\n.Net SqlClient Data Provider: Msg 5069, Level 16, State 1, Line 5 ALTER DATABASE statement
failed.\\r\\nScript execution error. The executed script:\\r\\nIF EXISTS (SELECT 1\\r\\n FROM [sys].[databases]\\r\\n WHERE
[name] = N'$(DatabaseName)')\\r\\n BEGIN\\r\\n ALTER DATABASE [$(DatabaseName)]\\r\\n SET CHANGE_TRACKING = OFF \\r\\n
WITH ROLLBACK IMMEDIATE;\\r\\n END\\r\\n\\r\\n\\r\\nScript execution error. The executed script:\\r\\nIF EXISTS (SELECT 1\\r\\n FROM
[sys].[databases]\\r\\n WHERE [name] = N'$(DatabaseName)')\\r\\n BEGIN\\r\\n ALTER DATABASE [$(DatabaseName)]\\r\\n
SET CHANGE_TRACKING = OFF \\r\\n WITH ROLLBACK IMMEDIATE;\\r\\n END\\r\\n\\r\\n\\r\\nPackage deployment failed\\r\\nARM-MSDeploy Deploy
Failed: 'Microsoft.Web.Deployment.DeploymentDetailedClientServerException: Could not deploy package.\\r\\nWarning SQL72030: If this deployment is
executed, changes to [xdb_collection].[ContactFacets] might introduce run-time errors in [xdb_collection].[GetContactFacetsChanges].\\r\\nWarning
SQL72030: If this deployment is executed, changes to [xdb_collection].[Contacts] might introduce run-time errors in
[xdb_collection].[GetContactsChanges].\\r\\nWarning SQL72030: If this deployment is executed, changes to [xdb_collection].[InteractionFacets] might
introduce run-time errors in [xdb_collection].[GetInteractionFacetsChanges].\\r\\nWarning SQL72030: If this deployment is executed, changes to
[xdb_collection].[Interactions] might introduce run-time errors in [xdb_collection].[GetInteractionsChanges].\\r\\nError SQL72014: .Net SqlClient
Data Provider: Msg 22115, Level 16, State 1, Line 5 Change tracking is enabled for one or more tables in database 'sandstorm-shard0-db'. Disable
change tracking on each table before disabling it for the database. Use the sys.change_tracking_tables catalog view to obtain a list of tables for
which change tracking is enabled.\\r\\nError SQL72045: Script execution error. The executed script:\\r\\nIF EXISTS (SELECT 1\\r\\n FROM
[sys].[databases]\\r\\n WHERE [name] = N'$(DatabaseName)')\\r\\n BEGIN\\r\\n ALTER DATABASE [$(DatabaseName)]\\r\\n
SET CHANGE_TRACKING = OFF \\r\\n WITH ROLLBACK IMMEDIATE;\\r\\n END\\r\\n\\r\\n\\r\\nError SQL72014: .Net SqlClient Data Provider: Msg
5069, Level 16, State 1, Line 5 ALTER DATABASE statement failed.\\r\\nError SQL72045: Script execution error. The executed script:\\r\\nIF EXISTS
(SELECT 1\\r\\n FROM [sys].[databases]\\r\\n WHERE [name] = N'$(DatabaseName)')\\r\\n BEGIN\\r\\n ALTER DATABASE
[$(DatabaseName)]\\r\\n SET CHANGE_TRACKING = OFF \\r\\n WITH ROLLBACK IMMEDIATE;\\r\\n END\\r\\n\\r\\n\\r\\n\\r\\n Learn
more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD. ---&gt; Microsoft.SqlServer.Dac.DacServicesException: Could not deploy
package.\\r\\nWarning SQL72030: If this deployment is executed, changes to [xdb_collection].[ContactFacets] might introduce run-time errors in
[xdb_collection].[GetContactFacetsChanges].\\r\\nWarning SQL72030: If this deployment is executed, changes to [xdb_collection].[Contacts] might
introduce run-time errors in [xdb_collection].[GetContactsChanges].\\r\\nWarning SQL72030: If this deployment is executed, changes to
[xdb_collection].[InteractionFacets] might introduce run-time errors in [xdb_collection].[GetInteractionFacetsChanges].\\r\\nWarning SQL72030: If
this deployment is executed, changes to [xdb_collection].[Interactions] might introduce run-time errors in
[xdb_collection].[GetInteractionsChanges].\\r\\nError SQL72014: .Net SqlClient Data Provider: Msg 22115, Level 16, State 1, Line 5 Change tracking is
enabled for one or more tables in database 'sandstorm-shard0-db'. Disable change tracking on each table before disabling it for the database. Use the
sys.change_tracking_tables catalog view to obtain a list of tables for which change tracking is enabled.\\r\\nError SQL72045: Script execution error.
The executed script:\\r\\nIF EXISTS (SELECT 1\\r\\n FROM [sys].[databases]\\r\\n WHERE [name] = N'$(DatabaseName)')\\r\\n
BEGIN\\r\\n ALTER DATABASE [$(DatabaseName)]\\r\\n SET CHANGE_TRACKING = OFF \\r\\n WITH ROLLBACK IMMEDIATE;\\r\\n
END\\r\\n\\r\\n\\r\\nError SQL72014: .Net SqlClient Data Provider: Msg 5069, Level 16, State 1, Line 5 ALTER DATABASE statement failed.\\r\\nError
SQL72045: Script execution error. The executed script:\\r\\nIF EXISTS (SELECT 1\\r\\n FROM [sys].[databases]\\r\\n WHERE
[name] = N'$(DatabaseName)')\\r\\n BEGIN\\r\\n ALTER DATABASE [$(DatabaseName)]\\r\\n SET CHANGE_TRACKING = OFF \\r\\n
WITH ROLLBACK IMMEDIATE;\\r\\n END\\r\\n\\r\\n\\r\\n\\r\\n at Microsoft.SqlServer.Dac.DeployOperation.ThrowIfErrorManagerHasErrors()\\r\\n at
| |
In short: No.
Looking at the @sitecore-jss/sitecore-jss-vue package on npmjs.com (https://www.npmjs.com/package/@sitecore-jss/sitecore-jss-vue) reveals that from version 19 onwards it supported VueJS 3 and above.
This table, https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1000576 indicates that Sitecore 10.2 or later is required for sitecore-jss-vue version 19.
So for:
VueJS
Sitecore
JSS
2.x
<= 10.1
<= 18
3.x
>= 10.2
>= 19
If you're not using JSS/Headless architecture, but are using Vue JS then you would not have any Sitecore dependencies preventing you from upgrading.
| Can Sitecore 9.1 with JSS use VueJS 3
We have a Sitecore 9.1 site which uses JSS 11.0.2 - the supported version for 9.1.
The node module @sitecore-jss/sitecore-jss-vue (currently also 11.0.2) mentions in its devDependencies section "vue": "^2.5.17" which to me implies that it can use anything upto but not including version 3.0.0 of VueJS.
Is my understanding correct here?
If not, how would I go about upgrading to VueJS 3.3.4? Would upgrading Sitecore and then the JSS modules be the only supported way to go?
| |
I'm glad that you are able to complete your setup. Make my comment as an answer to this question. As the below steps resolve your query mark this answer as accepted for community purposes.
To resolve the issue, please follow the below steps.
Try deleting the existing resource group where an error occurred and run the fresh installation as an incomplete setup might create an issue while running a script on top of it. Clean up that resource group by deleting resources or delete the resource group itself and try again.
If clean-up does not help then try with a new resource group.
Hope it helps!
| SQL execution errors while deploying Sitecore 9.3 to Azure app service
This is a follow-up question from another thread Facing issue while deploying Sitecore 9.3 to Azure app service.
Here are my scripts besides all parameter files
$SCSDK="F:\sitecore\azure\SAT250"
$SCTemplates="https://github.com/Sitecore/Sitecore-Azure-Quickstart-Templates/tree/master/Sitecore%209.3.0/XPSingle/azuredeploy.json"
$DeploymentId = "sandstorm"
$LicenseFile = "C:\sc930_install\license.xml"
$SubscriptionId = "<subscriptionid>"
$Location="South Central US"
$ParamFile="F:\sitecore\azure\XPSingle\azuredeploy.parameters.json"
$ArmTemplatePath = "F:\sitecore\azure\XPSingle\azuredeploy.json"
$CertificateFile = "C:\certificates\star.demo789.pfx"
$Parameters = @{
#set the size of all recommended instance sizes
#"sitecoreSKU"="Medium";
"deploymentId"=$DeploymentId;
"authCertificateBlob" = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($CertificateFile));
#by default this installs azuresearch
#if you uncomment the following it will use an existing solr connectionstring that
# you have created instead of using AzureSearch
#"solrConnectionString"= "https://myinstancesomewhere/solr";
}
Import-Module $SCSDK\tools\Sitecore.Cloud.Cmdlets.psm1 -Verbose
Connect-AzAccount -tenantid <tenantid>
Set-AzContext -SubscriptionId $SubscriptionId
Start-SitecoreAzureDeployment -Verbose -Name $DeploymentId -Location $Location -ArmTemplateUrl $SCTemplates -ArmParametersPath $ParamFile -LicenseXmlPath $LicenseFile -SetKeyValue $Parameters
Unfortunately, I always got the following error:
ARM-MSDeploy Deploy Failed: 'Microsoft.Web.Deployment.DeploymentDetailedClientServerException: Could not deploy package.
Warning SQL72030: If this deployment is executed, changes to [xdb_collection].[ContactFacets] might introduce run-time errors in [xdb_collection].[GetContactFacetsChanges].
Warning SQL72030: If this deployment is executed, changes to [xdb_collection].[Contacts] might introduce run-time errors in [xdb_collection].[GetContactsChanges].
Warning SQL72030: If this deployment is executed, changes to [xdb_collection].[InteractionFacets] might introduce run-time errors in [xdb_collection].[GetInteractionFacetsChanges].
Warning SQL72030: If this deployment is executed, changes to [xdb_collection].[Interactions] might introduce run-time errors in [xdb_collection].[GetInteractionsChanges].
Error SQL72014: .Net SqlClient Data Provider: Msg 22115, Level 16, State 1, Line 5 Change tracking is enabled for one or more tables in database 'sandstorm-shard0-db'.
Disable change tracking on each table before disabling it for the database. Use the sys.change_tracking_tables catalog view to obtain a list of tables for which change tracking is enabled.
Error SQL72045: Script execution error. The executed script:
IF EXISTS (SELECT 1 FROM [sys].[databases] WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)] SET CHANGE_TRACKING = OFF WITH ROLLBACK IMMEDIATE;'
END
Any help is appreciated!
as suggested I deleted all previously leftover resources, re-run the scripts and no error.
| |
"Insert from template" option appear just for the admin user. You can not really remove it really easy and I don't recommend it to remove it.
To have a flexible solution I recommend you to use Insert options rules:
Marek has a great post about insert options rules here: https://www.skillcore.net/sitecore/sitecore-insert-options-rules
More info here: https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/insert-rules-and-insert-option-rules.html
| How to only allow the creation of a child item by given template
I have a requirement to only allow users to create child item by given template. I am thinking to create a template called TemplatedFolder with one field called AllowedTemplateIds as Treelist to configure that folder to contain all the allowed template(s) (most of the time it will be just one template).
What type of code should I write to make sure the following:
from the content tree, when user click on insert menu,
allowed template names will be available (this can be done through assign the template to this folder)
remove the option of "insert from template" only for the TemplatedFolder as parent, not impact any other folders
| |
Install react-google-recaptcha Package
To use the ReCAPTCHA component, we need to install the react-google-recaptcha package. Run the following command in your project directory:
npm install react-google-recaptcha
Adding reCAPTCHA to the Contact Form
In the component where you have implemented the contact form, add the reCAPTCHA widget to the form. Update your ContactUsForm.tsx component as follows:
//...(Existing imports)
import ReCAPTCHA from 'react-google-recaptcha';
//...(Sitecore fields)
const FORM_DEFAULT: {
[key: string]: string;
} = {
firstName: '',
lastName: '',
message: '',
captchaToken: '',
};
const ContactUsForm = ({ fields }: ContactUsFormProps): JSX.Element => {
const [formData, setFormData] = useState(FORM_DEFAULT);
const [successMsgCss, setSuccesssMsg] = useState(false);
// Create a ref for the reCAPTCHA widget
const recaptcha: RefObject<ReCAPTCHA> = useRef(null);
// ... (Existing functions)
const formSubmit = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
formData.recipient = fields.emailRecipient.value;
formData.emailSubject = fields.emailSubject.value;
fetch('/api/contact', {
method: 'POST',
headers: {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
},
body: JSON.stringify(formData),
})
.then((response) => {
console.log('response recieved');
if (response.status === 200) {
console.log('response succeeded');
setSuccesssMsg(true);
setFormData(FORM_DEFAULT);
recaptcha?.current?.reset();// reset recaptcha after submission
}
})
.catch((error) => {
console.error(error);
});
}
};
const onCaptchaChange = (token: string | null) => {
// Set the captcha token when the user completes the reCAPTCHA
if (token) {
formData.captchaToken = token;
}
};
return (
{/* ... (existing TSX markup) */}
<div className="pr-15px pl-25px pt-50px pb-25px mx-auto max-w-1200px w-full">
<div>
{/* ... (existing form fields) */}
{/* Add the reCAPTCHA widget */}
<div className="pb-20px">
<ReCAPTCHA
size="normal"
sitekey="YOUR_RECAPTCHA_SITE_KEY"
onChange={onCaptchaChange}
ref={recaptcha}
/>
</div>
{/* ... (existing submit button) */}
</form>
</div>
Server-Side Verification
Update your API route (/pages/api/contact.ts) to validate the reCAPTCHA token received from the frontend:
//...existing imports
import axios from 'axios';
export default async function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
// ... (existing transporter setup and mailData)
// Validate the reCAPTCHA token on the server-side
try {
const response = await axios.post(
`https://www.google.com/recaptcha/api/siteverify?secret=${process.env.RECAPTCHA_SECRET_KEY}&response=${req.body.captchaToken}`
);
if (response.data.success) {
//reCaptcha verification successfull
transporter.sendMail(mailData, function (err, info) {
if (err) {
console.log(err);
res.status(500).send('Internal Server Error');
} else {
console.log('successful');
console.log(info);
res.status(200).end();
}
});
} else {
// reCAPTCHA verification failed
res.status(400).send('reCAPTCHA verification failed.');
}
} catch (error) {
console.error(error);
res.status(500).send('Internal server error');
}
}
More information you can find here: https://www.getfishtank.com/blog/securing-nextjs-contact-form-using-google-recaptcha
| Is there any possible way to use Custom GoogleRecaptcha Field in Sitecoreheadless10.3XM
I am using sitecore 10.3XM SXA with HeadlessNextJs also we are using sitecore forms. We have a requirement to implement Google Recaptcha in our Forms.So We have created a Custom Google Recaptcha Field following this blog.
https://sitecorescientist.com/2018/11/11/sitecore-9-forms-part-2-google-recaptcha-field/
but after implementing this we are facing this issue
Google Recaptcha: No renderer for form element type {71266376-735C-4942-8B39-2456857EC7E6}
| |
Yes, you can use Kudu Console to upload configuration patch files.
see the blog post: Copying and unzipping files using Kudu on Azure App Service
From your FTP client example WinSCP.
In the Web App, go to FTPS Credentials in the Deployment Center.
You can get the hostname, username, and password from the created App Service. See the blog post (Step 3): https://www.c-sharpcorner.com/article/configuring-ftp-server-for-azure-app-service/
The ideal solution is a patch your config file in your project solution and deploy it by CI/CD pipeline.
Note: Solutions 1 and 2 will restart your App Pool and recycle. Your application will go down after implementation.
| How to patch configuration for Sitecore deployed in Azure App service
I need to patch a configuration for my Sitecore deployed on Azure App service. Should I go to App service -> Advanced Tools use Kudu to upload configuration patch files to App_Config\Include or is there another way of doing it in PaaS model Sitecore?
| |
You can export Media files in CSV format and upload them into the Content hub.
Step 1:
Sitecore Media Library Export to CSV:PowerShell extensions script to help export the media library assets file names and path to a spreadsheet.
$everythingUnderMediaLibrary = Get-Item master: -Query
"/sitecore/media library//*"
$outputFilePath = "C:\Media_Library_Export.csv"
#Create an empty csv file and paste the path here $results = @(); $everythingUnderMediaLibrary | ForEach-Object {
$properties = @{
ItemID = $_.ID
Name = "$($_.Name)"
ItemPath = "$($_.ItemPath)"
Extension = "$($_.Extension)"
Title = $_.Title
Alt_text = $_.Alt
Template = $_.TemplateName }
$results += New-Object psobject -Property $properties
}
$Results | Select-Object ItemID,Name,ItemPath,Extension,Title,Alt_text,Template | Export-Csv
-notypeinformation -Path $outputFilePath
For reference : https://madhuanbalagan.com/migrate-sitecore-media-library-assets-to-dam
Step 2: Create Taxonomy in Content hub Instance
Create Taxonomy/ Option List as per business requirements in Content hub.
Step 3: Update Excel data as per Taxonomy
Update Column name in the exported sheet as per Taxonomy name
Update all data in excel according to the Taxonomy's value Identifier. For example:
Also, Rename the Name of Excel sheet (Name should be always "M.Asset")
Step 4: Upload Assets in Content hub through Import Excel
Step 5: Install Connector in Sitecore Instance (as per Sitecore version and content hub instance version)
Before installing the Connector Package, you need to add Sitecore url in Content hub Settings.
Go to Manage > Settings > Portal Configuration > CORSConfiguration
See below example:
After Installation of Connector in Sitecore instance, you can see new browser link "Browse Sitecore DAM".
Step 6: Run PowerShell Script in Sitecore to change the pointing URLs of images / Rich Text
Step 7: Check new URL in Sitecore
Now you can search any Image /PDF /Rich Text item. The URLs should be changed and pointing to Content hub URL.
For Example:
Sitecore Path: /sitecore/content/Global/Components/Rich Text/IND Get Started/Tools and Resources
New URL: https://ch-p-001.sitecorecontenthub.cloud/api/public/content/e9df763864af41ba8ecf6ed2e1f525ea
Old Sitecore URL: https://sitecoreinstance/-/media/sitecore/pdf-documents/individual/1848831_gettingstarted_ind_id.ashx
For reference: https://www.altudo.co/insights/blogs/how-to-migrate-assets-from-sitecore-media-library-to-content-hub
| Migrate sitecore media library to DAM and update the media links in Sitecore
We have installed the Content Hub connector in Sitecore 10.2 with Content Hub 5.0.
Now there is one requirement from the client that all the media available in the Sitecore should be migrated to the Content Hub DAM and then all the Sitecore links should follow the Content Hub media's URL after migration.
So, does someone have any idea of how to migrate the media to the Content hub and then update the references of media in Sitecore fields to follow the DAM media's URL?
| |
Discussed this with Sitecore Search team and it's been confirmed that the visitor context parameters are not supported yet. However, it is in the roadmap, and the team is working on it, so I'll update the answer once this feature is fully released.
| Does Sitecore Search JS SDK support visitor context in widget rules?
I have got a test solution created from Sitecore Search JS SDK Starter Kit. Basic search and filtering functionality works correctly and now I want to configure additional widget rules based on visitor context.
I followed this documentation page for setting up a simple rule that should be applied when a page URL includes a specific UTM parameter. This is how the rule looks in CEC:
However, I can't make it work with my test Search front-end, the rule does not seem to be triggering. I've checked the API request headers and payload, and can't see any of the attributes that are available for selection in the UI (UTM parameters, FB click ID, app type, etc). So I'm not sure if some configuration is missing or it is not supported by Search JS SDK.
Has anybody managed to set up a rule with visitor context and connect it to a front-end website with Sitecore Search JS SDK?
| |
There are a few tools/scripts that can help parse through your TDS project and convert them to the equivalent configuration for Sitecore Content Serialization (SCS):
Get-PathsFromTds.ps1: A powershell script by Sitecore MVP Aaron Bickle to generate SCS JSON files. Does not support role migration.
Sitecore Serialization Converter: A .NET application by Sitecore Solution Architect Joseph Long that you can configure to parse through TDS projects and generate SCS JSON files. Supports role migration but does not migrate role inheritance.
These tools may not cover every single use case. You will likely need to extend them to your needs. You should also note that these convert the project configurations, but they do not deploy content during this step. You will do this in the next step.
You could also do this manually, but I would recommend using a tool to get started so you have less work to do overall.
| How to migrate from TDS to CLI
I have an existing project that uses TDS and now we have to use CLI instead.
Either in the code or the "serialization" folders, I could not find any config file which mentions that paths of all the items that are to be serialized.
Because, an additional challenge for us is to also find out what are the items that need to be serialized.
When I opened one of the project files, I see this, but it is difficult from here to know which item and to be included with child items or not.
Is there any way I could find the list of items & rules, which were configured to be serialized. I could then use the same to configure Sitecore CLI.
We are using 10.1.3 on managed cloud.
Any other help for this migration is much appreciated.
Thank you
| |
I faced the same issue and fixed it.
Root cause:: you do not have the SearchResults query pipeline.
Fix:: So please add a new pipeline by duplicating the existing default pipeline in the coveo cloud platform. Or else corect the pipeline name in Coveo settings in sitecore.
| getting Unknown query pipeline: name or id SearchResults
I have installed coveo 5.x version in Sitecore 10.3 and completed all the initial setup and rebuild index as well. When I click in page level search button getting below exception.
ERROR A "Bad Request" error was detected when getting the response from Coveo. Response Content:
{
"statusCode" : 400,
"message" : "Unknown query pipeline: name or id \"SearchResults\"",
"type" : "UnknownQueryPipelineOtherException",
"executionReport" : [ {
"children" : [ {
"name" : "RequestId",
"description" : "The id correlating logs for this request",
"duration" : 0,
"X-Request-ID" : "XXXX"
}, {
"name" : "Organization ID",
"description" : "Organization ID",
"duration" : 0,
"coveo_organization" : "xxxxxxxx"
}, {
"name" : "PerformAuthentication",
"description" : "Perform authentication",
"duration" : 0,
"configured" : {
"primary" : "CloudToken"
},
"result" : {
"userIds" : [ {
"name" : "anonymous",
"kind" : "User",
"provider" : "Email Security Provider",
"infos" : { }
} ],
"roles" : [ "queryExecutor" ],
"queryRestrictions" : { },
"userGroups" : [ ]
},
"children" : [ {
"name" : "ResolveProviderAuthentication",
"description" : "Resolve authentication of provider: CloudToken",
"duration" : 0,
"result" : {
"userIds" : [ {
"name" : "anonymous",
"kind" : "User",
"provider" : "Email Security Provider",
"infos" : { }
} ],
"roles" : [ "queryExecutor" ],
"queryRestrictions" : { },
"userGroups" : [ ]
}
} ]
}, {
"name" : "PerformAuthentication",
"description" : "Perform authentication",
"duration" : 0,
"configured" : {
"secondary" : [ "sso" ],
"mandatory" : [ ]
},
"result" : {
"userIds" : [ {
"name" : "anonymous",
"kind" : "User",
"provider" : "Email Security Provider",
"infos" : { }
} ],
"roles" : [ "queryExecutor" ],
"queryRestrictions" : { },
"userGroups" : [ ]
},
"children" : [ {
"name" : "MergeAuthentications",
"description" : "Merge authentications (if needed)",
"duration" : 0,
"result" : {
"userIds" : [ {
"name" : "anonymous",
"kind" : "User",
"provider" : "Email Security Provider",
"infos" : { }
} ],
"roles" : [ "queryExecutor" ],
"queryRestrictions" : { },
"userGroups" : [ ]
}
} ]
}, {
"name" : "ResolveContext",
"description" : "Resolve context",
"duration" : 2,
"result" : {
"userAgent" : {
"raw" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
"browser" : [ "chrome" ],
"device" : [ "desktop", "pc", "windows" ],
"os" : [ "windows" ]
},
"searchHub" : "search",
"tab" : null,
"referrer" : "https://sitecoreurl/",
"locale" : "en",
"context" : { },
"expressions" : {
"q" : {
"original" : "",
"parsed" : null
},
"aq" : {
"original" : "((((@dynewcontenttype<>unknown (@z95xpath<>e036c4a9203e4ebbafd775c6bdd44045 (@z95xpath<>172bf9048ca04510bf40c34af25b0ae3 @z95xpath<>9ae86ed349f7459684830161f7b91a4a))) OR @dynewcontenttype==FAQs) OR @source==\"ATCC-CH\") NOT @z95xtemplate==(ADB6CA4F03EF4F47B9AC9CE2BA53FF97,FE5DD82648C6436DB87A7C4210C7413B))",
"parsed" : "((((@dynewcontenttype<>unknown (@z95xpath<>e036c4a9203e4ebbafd775c6bdd44045 (@z95xpath<>172bf9048ca04510bf40c34af25b0ae3 @z95xpath<>9ae86ed349f7459684830161f7b91a4a))) OR @dynewcontenttype==FAQs) OR @source==\"ATCC-CH\") NOT @z95xtemplate==(ADB6CA4F03EF4F47B9AC9CE2BA53FF97,FE5DD82648C6436DB87A7C4210C7413B))"
},
"cq" : {
"original" : "((@z95xlanguage==en) (@z95xlatestversion==1) (@source==\"Coveo_web_index - ATCC-INTDEV-103\")) OR (@source==(CRMQA,\"ATCC-CH\"))",
"parsed" : "((@z95xlanguage==en) (@z95xlatestversion==1) (@source==\"Coveo_web_index - ATCC-INTDEV-103\")) OR (@source==(CRMQA,\"ATCC-CH\"))"
},
"dq" : {
"original" : "",
"parsed" : null
},
"lq" : {
"original" : "",
"parsed" : null
}
},
"enableDuplicateFiltering" : false,
"filterField" : null,
"filterFieldRange" : 5,
"parentField" : null,
"childField" : null,
"recommendation" : null,
"lowercaseOperators" : false,
"sortCriteria" : [ "relevancy" ]
}
}, {
"name" : "ResolvePipeline",
"description" : "Resolve pipeline",
"error" : "Unknown query pipeline: name or id \"SearchResults\""
} ]
} ]
}
I found one article related to my issues but I dont know where to check whether i have given pipeline or not.
https://connect.coveo.com/s/article/6892
could someone help me here
| |
Adding more details as per Anna's suggestion we got the fix from Sitecore Support.
I'd like to inform you that the latest cumulative hotfix for Sitecore 9.3 includes a fix for bug #332061.
Please find the hotfix available at the following URL:
https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1001332
Be aware that the hotfix was built specifically for Sitecore 9.3 Initial Release, and you should not install it on other Sitecore versions or in combination with other hotfixes unless explicitly instructed by Sitecore Support.
Note that you need to extract ZIP file contents to locate installation instructions and related files inside it. Unless stated differently in the installation instructions, the hotfix should be installed on CM instance and then synced with other instances using your regular development practices.
Hope it helps!
| My Items button not working after upgrade to Sitecore 9.3
After upgrading from Sitecore 9.0.2 to Sitecore 9.3, When clicking on My Items (Under Review Ribbon) it does not show the My Items Dialog Box. It is an OOTB function and does not have any customization on top of it.
I already checked a log file there is no error logged. Also tried to open the URL in a new tab and there was no response. The console is clean no errors.
At some point, it returns a timeout error as the request is in a pending state and never returns the response.
Any thoughts or feedback?
| |
We have achieved this by creating a custom middleware function.
Create a file for your custom middleware, let's say smallcase-url, in your project's directory, such as
src/<appname>/src/lib/middleware/smallcase-url.ts
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';
export function smallcaseurl(req: NextRequest): NextResponse {
const { pathname, origin } = req.nextUrl;
if (pathname === pathname.toLowerCase()) {
return NextResponse.next();
}
return NextResponse.redirect(new URL(origin + pathname.toLowerCase()), 308);
}
Import the smallcaseurl function and include it in your main middleware, typically located at src/<appname>/src/middleware.ts. Make sure the smallcaseurl middleware is applied before other middleware or routing logic.
import type { NextRequest, NextFetchEvent } from 'next/server';
import middleware from 'lib/middleware';
import { smallcaseurl } from 'lib/middleware/smallcase-url';
// eslint-disable-next-line
export default async function (req: NextRequest, ev: NextFetchEvent) {
// Apply the existing middleware.
await middleware(req, ev);
// Apply the smallcaseurl middleware to handle URL case-insensitivity.
return smallcaseurl(req);
}
...
| XMCloud Vercel app Redirect URL from uppercase to lowercase
We have an XMCloud application using NextJs, which we are deploying to Vercel. On the Vercel side, it is working fine. We have a requirement where if someone is adding uppercase/Camelcase in the URLs or a single/multiple uppercase chars in the URL client wants it to redirect to lowercase. see below example -
https://mydomain.com/AboutUs -> https://mydomain.com/aboutus
https://mydomain.com/Aboutus -> https://mydomain.com/aboutus
https://mydomain.com/ABOUTUS-> https://mydomain.com/aboutus
https://mydomain.com/ABOUtus -> https://mydomain.com/aboutus
Since this is the next 12.3 application, I tried updating the code into middleware like this -
if (req.nextUrl.pathname !== req.nextUrl.pathname.toLowerCase()) {
const url = req.nextUrl.clone()
url.pathname = url.pathname.toLowerCase()
url.href = url.href.toLowerCase();
url.locale = req.nextUrl.locale;
return NextResponse.redirect(url)
}
the above code is working fine locally with connected mode but on vertical it is changing the URL into lowercase but at the same time refreshing the page again and again in 2-3 seconds (infinite times). Anyone please provide some insight on this issue?
| |
I have a few suggestions as mentioned below, could you please try them if not done?
You can locate the App_Config/Sitecore/Mvc/Sitecore.Mvc.config file, there is a setting called Mvc.UsePhysicalViewsIfNewer, change its default value false to true.
As per the blog post, please ensure this custom class [CustomAssetLinksGenerator] is also added to your implementation which has a method GenerateAssetLinks.
You can take this class from this.
Git Repo https://github.com/jitendrachilate/ThemeSwitcher.git
https://github.com/jitendrachilate/ThemeSwitcher/blob/master/Pipeline/CustomThemingContext.cs
Also, please refer to the below git link which has CustomSxaLayout.cshtml file. Please check line no 10 wherein the CustomThemingContext.cs file is referred to.
Please ensure the same in your implementation.
https://github.com/jitendrachilate/ThemeSwitcher/blob/master/Views/SxaLayout/CustomSxaLayout.cshtml
Blog Post: https://blogs.perficient.com/2023/09/14/switch-sxa-themes-based-on-cookie-value/
Please let me know if you still have any queries. Thank you.
| Theme is not switched when overriding DoGetThemeItem
I am implementing this article so I can switch themes based on the a cookie or query string. My code is as follows.
protected override Item DoGetThemeItem(Item item, DeviceItem device)
{
Item themeItem = base.DoGetThemeItem(item, device);
Item newThemeItem;
string currentUrl = HttpContext.Current.Request.Url.ToString();
var queryString = HttpUtility.ParseQueryString(HttpContext.Current.Request.Url.Query);
if (HttpContext.Current.Request.Cookies["ThemeCookie"] != null)
{
string themeValue = HttpContext.Current.Request.Cookies["ThemeCookie"].Value;
if (themeValue == "something")
{
newThemeItem = global::Sitecore.Context.Database.GetItem(new ID(Foundation.Sitecore.Constants.MyThemeID));
}else
{
newThemeItem = themeItem;
}
return newThemeItem;
}
else if (!string.IsNullOrEmpty(queryString["theme"]))
{
string themeValue = queryString["theme"];
if (themeValue == "something")
{
newThemeItem = global::Sitecore.Context.Database.GetItem(new ID(Foundation.Sitecore.Constants.MyThemeID));
}
else
{
newThemeItem = themeItem;
}
return newThemeItem;
}
else
{
return themeItem;
}
}
private void SetThemeCookie(string themeName)
{
HttpCookie cookie = new HttpCookie("ThemeCookie", themeName);
cookie.Expires = DateTime.Now.AddDays(7);
cookie.SameSite = System.Web.SameSiteMode.None;
cookie.Path = "/";
cookie.Domain = "dev.local";
HttpContext.Current.Response.Cookies.Add(cookie);
}
The problem it only switches themes after I run "sxa rebuild All". Any idea why?
| |
These OOB comments in the render.js/render.ts file provide additional context:
/**
* This Next.js API route is used to handle POST requests from the Sitecore Experience Editor.
* This route should match the `serverSideRenderingEngineEndpointUrl` in your Sitecore configuration,
* which is set to "http://localhost:3000/api/editing/render" by default (see \sitecore\config\JssNextWeb.config).
*
* The `EditingRenderMiddleware` will
* 1. Extract editing data from the Experience Editor POST request
* 2. Stash this data (for later use in the page render request) via the `EditingDataService`, which returns a key for retrieval
* 3. Enable Next.js Preview Mode, passing our stashed editing data key as preview data
* 4. Invoke the actual page render request, passing along the Preview Mode cookies.
* This allows retrieval of the editing data in preview context (via the `EditingDataService`) - see `SitecorePagePropsFactory`
* 5. Return the rendered page HTML to the Sitecore Experience Editor
*/
// Bump body size limit (1mb by default) for Experience Editor payload
// See https://nextjs.org/docs/api-routes/api-middlewares#custom-config
As the error message suggests, editing data is unable to be extracted from the request. Some scenarios in which you may see this error are:
bodyParser middleware is not enabled on the route
You have hit the sizeLimit defined in your bodyParser config
The POST request lacks a request body entirely (undefined) -- this will 100% trigger the error described
The POST request body is malformed
In order to troubleshoot, check your Next logs for more error details. You may see something like:
Error: Unable to extract editing data from request. Ensure `bodyParser` middleware is enabled on your Next.js API route.
at extractEditingData (C:\projects\MySite\node_modules\@sitecore-jss\sitecore-jss-nextjs\dist\cjs\middleware\editing-render-middleware.js:174:15)
at EditingRenderMiddleware.<anonymous> (C:\projects\MySite\node_modules\@sitecore-jss\sitecore-jss-nextjs\dist\cjs\middleware\editing-render-middleware.js:54:37)
at Generator.next (<anonymous>)
at C:\projects\MySite\node_modules\@sitecore-jss\sitecore-jss-nextjs\dist\cjs\middleware\editing-render-middleware.js:8:71
at new Promise (<anonymous>)
at __awaiter (C:\projects\MySite\node_modules\@sitecore-jss\sitecore-jss-nextjs\dist\cjs\middleware\editing-render-middleware.js:4:12)
at EditingRenderMiddleware.handler (C:\projects\MySite\node_modules\@sitecore-jss\sitecore-jss-nextjs\dist\cjs\middleware\editing-render-middleware.js:28:38)
at Object.apiResolver (C:\projects\MySite\node_modules\next\dist\server\api-utils\node.js:366:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async DevServer.runApi (C:\projects\MySite\node_modules\next\dist\server\next-server.js:481:9)
You can also print the request handler to the console like so:
export const config = {
api: {
bodyParser: {
sizeLimit: '20mb',
},
},
}
// Wire up the EditingRenderMiddleware handler
const handler = new EditingRenderMiddleware().getHandler();
console.log(`***HANDLER*** ${handler}`)
Output:
(req, res) => __awaiter(this, void 0, void 0, function* () {
var _e;
const { method, query, body, headers } = req;
sitecore_jss_1.debug.experienceEditor('editing render middleware start: %o', {
method,
query,
headers,
body,
});
if (method !== 'POST') {
sitecore_jss_1.debug.experienceEditor('invalid method - sent %s expected POST', method);
res.setHeader('Allow', 'POST');
return res.status(405).json({
html: `<html><body>Invalid request method '${method}'</body></html>`,
});
}
// Validate secret
const secret = (_e = query[editing_data_service_2.QUERY_PARAM_EDITING_SECRET]) !== null && _e !== void 0 ?
_e : body === null || body === void 0 ? void 0 : body.jssEditingSecret;
if (secret !== utils_1.getJssEditingSecret()) {
sitecore_jss_1.debug.experienceEditor('invalid editing secret - sent "%s" expected "%s"', secret, utils_1.getJssEditingSecret());
return res.status(401).json({
html: '<html><body>Missing or invalid secret</body></html>',
});
}
try {
// Extract data from EE payload
const editingData = extractEditingData(req);
// Resolve server URL
const serverUrl = this.resolveServerUrl(req);
// Stash for use later on (i.e. within getStatic/ServerSideProps).
// This ultimately gets stored on disk (using our EditingDataDiskCache) for compatibility with Vercel Serverless Functions.
// Note we can't set this directly in setPreviewData since it's stored as a cookie (2KB limit)
// https://nextjs.org/docs/advanced-features/preview-mode#previewdata-size-limits)
const previewData = yield this.editingDataService.setEditingData(editingData, serverUrl);
// Enable Next.js Preview Mode, passing our preview data (i.e. editingData cache key)
res.setPreviewData(previewData);
// Grab the Next.js preview cookies to send on to the render request
const cookies = res.getHeader('Set-Cookie');
// Make actual render request for page route, passing on preview cookies.
// Note timestamp effectively disables caching the request in Axios (no amount of cache headers seemed
to do it)
const requestUrl = this.resolvePageUrl(serverUrl, editingData.path);
sitecore_jss_1.debug.experienceEditor('fetching page route for %s', editingData.path);
const pageRes = yield this.dataFetcher
.get(`${requestUrl}?timestamp=${Date.now()}`, {
headers: {
Cookie: cookies.join(';'),
},
})
.catch((err) => {
// We need to handle not found error provided by Vercel
// for `fallback: false` pages
if (err.response.status === 404) {
return err.response;
}
throw err;
});
let html = pageRes.data;
if (!html || html.length === 0) {
throw new Error(`Failed to render html for ${requestUrl}`);
}
// replace phkey attribute with key attribute so that newly added renderings
// show correct placeholders, so save and refresh won't be needed after adding each rendering
html = html.replace(new RegExp('phkey', 'g'), 'key');
// When SSG, Next will attempt to perform a router.replace on the client-side to inject the query string parms
// to the router state. See https://github.com/vercel/next.js/blob/v10.0.3/packages/next/client/index.tsx#L169.
// However, this doesn't really work since at this point we're in the editor and the location.search has nothing
// to do with the Next route/page we've rendered. Beyond the extraneous request, this can result in a 404 with
// certain route configurations (e.g. multiple catch-all routes).
// The following line will trick it into thinking we're SSR, thus avoiding any router.replace.
html = html.replace(constants_1.STATIC_PROPS_ID, constants_1.SERVER_PROPS_ID);
const body = { html };
// Return expected JSON result
sitecore_jss_1.debug.experienceEditor('editing render middleware end: %o', { status: 200, body });
res.status(200).json(body);
}
catch (error) {
console.error(error);
if (error.response || error.request) {
// Axios error, which could mean the server or page URL isn't quite right, so provide a more helpful hint
console.info(
// eslint-disable-next-line quotes
"Hint: for non-standard server or Next.js route configurations, you may need to override the 'resolveServerUrl' or 'resolvePageUrl' available on the 'EditingRenderMiddleware' config.");
}
res.status(500).json({
html: `<html><body>${error}</body></html>`,
});
}
})
In summary, it looks like you are hitting this in the handler as a result of an error during the call to extractEditingData():
res.status(500).json({
html: `<html><body>${error}</body></html>`,
);
Your specific issue may vary, so use the above as a guide to investigate further.
| POSTing to localhost:3000/api/editing/render results in error "Unable to extract editing data from request"
I am doing some troubleshooting with my Sitecore(10.2.1)/NextJS(12.3.1)/JSS(20.0.3)/Docker setup. I am running my backend in Docker and my front end via npm on my host machine.
I am POSTing to http://localhost:3000/api/editing/render but I get an error:
{
"html": "<html><body>Error: Unable to extract editing data from request. Ensure `bodyParser` middleware is enabled on your Next.js API route.</body></html>"
}
I do have bodyParser definitions, so it is not clear what the problem is.
| |
In the release notes for version 10.3 we found the matching bug:
If a Responsive Image variant field points to a broken link, a
NullReferenceException error occurs.
Upgrading is 10.3 is not an option though. But I found a way to "patch" the issue. The problem is located in RenderFallbackResponsiveMImage which uses the (deprecated) StylelabsDataExtractor.GetSrcAttributeValue. Replacing that with the new version for that function actually already solves the issue.
Note that this code came with the hotfix (10.2.1).
If you want to fix this without upgrading, create a class like this:
using System.Web.UI;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.Web.UI.WebControls;
using Sitecore.XA.Feature.Stylelabs.Services;
using Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField;
namespace Foundation.Infrastructure
{
public class RenderFallbackResponsiveMImage : Sitecore.XA.Feature.Stylelabs.Pipelines.RenderVariantField.RenderFallbackResponsiveMImage
{
public RenderFallbackResponsiveMImage(IStylelabsDataExtractor stylelabsDataExtractor) : base(stylelabsDataExtractor)
{
}
public override void RenderField(RenderVariantFieldArgs args)
{
var variantField = args.VariantField;
if (args.Item.Paths.IsMediaItem || string.IsNullOrWhiteSpace(variantField?.FieldName))
{
base.RenderField(args);
}
else if (PageMode.IsExperienceEditorEditing)
{
args.ResultControl = (Control)new FieldRenderer()
{
Item = args.Item,
FieldName = variantField.FieldName,
DisableWebEditing = !args.IsControlEditable
};
args.Result = this.RenderControl(args.ResultControl);
}
else
{
var field1 = args.Item.Fields[variantField.FieldName];
if (field1 == null)
{
return;
}
if ((FieldTypeManager.GetField(field1) is ImageField field2 ? field2.MediaItem : (Item)null) == null)
{
field2 = (ImageField)field1;
string srcAttributeValue = this.StylelabsDataExtractor.GetAttributeValue("src", field2);
Control fieldRenderer = this.CreateFieldRenderer(args);
this.RenderControl(args, fieldRenderer, srcAttributeValue);
}
else
{
base.RenderField(args);
}
}
}
}
}
Note that we are using this.StylelabsDataExtractor.GetAttributeValue("src", field2) now - this is the line that solves the problem.
Patch the config:
<sitecore>
<pipelines>
<renderVariantField>
<processor patch:instead="*[@type='Sitecore.XA.Feature.Stylelabs.Pipelines.RenderVariantField.RenderFallbackResponsiveMImage, Sitecore.XA.Feature.Stylelabs']"
type="Foundation.Infrastructure.RenderFallbackResponsiveMImage, Foundation.Infrastructure" resolve="true" />
</renderVariantField>
</pipelines>
</sitecore>
and you're good to go.
ps: Don't forget to delete this code if you upgrade to 10.3.
| SXA Responsive Image - null reference
We noticed that if an image is not published, pages containing that image in a Responsive Image rendering variant are broken. And not just missing the image - but actually broken.
The site is running on Sitecore 10.2 and is patched with the latest hotfix packages so actually running on 10.2.1 (actually even 10.2.2 now).
Once the image is published, the issue is gone. If no image is selected, there is also no issue. It seems that if there is a reference to an image that does not exist in the web database, the component fails.
| |
1. Define source entity (Form)
First of all you need to define the data structure of the data coming from your form. To do this, create a folder called Forms Data Access/Value Accessor Sets/Providers/ and child Form Model of type Value Accessor Set. Under your Form Model, add a new Property Value Accessor for each property being sent through the form β specify the relevant Property Name in each.
2. Define target entity (Incident)
Next you need to define the structure of the entity you need to create in dynamics. To do this, locate the folder called Dynamics Data Access/Value Accessor Sets/Providers/Dynamics. Add a child Incident of type Value Accessor Set to represent your dynamics entity. Under this, add a child of type Entity Attribute Value Accessor for each property that is required to create the entity β specify Attribute Name.
3. Define the mapping between source and target
Create a new Value Mapping Sets Folder called Forms to Dynamics Mappings in this location Dyanamics Tenant/Value Mapping Sets. Under this, add a new Value Mapping Set called Form to Incident. Then add a new Value Mapping for each property you want to map between source (form) and target (dynamics entity). In each of these define source and target from the previous sections.
4. Create a new template
Create a new pipeline step template called Read Form Data (with base template Base Pipeline Step). Add a field called Form Guid single-line text and also any other settings that might be useful.
5. Create FormSettings and FormModel classes
The properties that are contained within these classes will depend entirely on your own setup. The FormModel class should contain exactly the same properties that you define in the source section (1) above. Note, you can define any types of property here (i.e. EntityReference, OptionSet, Guid, AssociateRequest). These will be mapped through in the same format to the target entity. The FormSettings class should match exactly the additional settings you defined in the new template (step 4).
6. Create the following class ReadFormDataStepConverter
This class effectively reads our settings and makes them available inside the pipeline processor. Note - The SupportedId in this class should use the ID from your new template (step 4)
using Sitecore.DataExchange.Attributes;
using Sitecore.DataExchange.BatchHandling;
using Sitecore.DataExchange.Converters.PipelineSteps;
using Sitecore.DataExchange.Extensions;
using Sitecore.DataExchange.Models;
using Sitecore.DataExchange.Plugins;
using Sitecore.DataExchange.Repositories;
using Sitecore.Services.Core.Model;
using YourNameSpace.Models;
namespace YourNameSpace.PipelineSteps
{
[SupportedIds(new string[] { "{E65B7E7C-44AB-4071-B040-3D3F7835AAAC}" })]
public class ReadFormDataStepConverter : BasePipelineStepConverter
{
public const string FieldNameBatchEntryStoragePluginLocation = "BatchEntryStoragePluginLocation";
public const string FormGuid = "FormGuid";
/** DEFINE OTHER SETTINGS HERE **/
public ReadFormDataStepConverter(IItemModelRepository repository)
: base(repository)
{
}
protected override void AddPlugins(ItemModel source, PipelineStep pipelineStep)
{
BatchEntryStorageSettings batchEntryStorageSettings = new BatchEntryStorageSettings
{
PluginLocation = GetGuidValue(source, "BatchEntryStoragePluginLocation")
};
FormSettings formSettings = new FormSettings
{
FormGuid = GetStringValue(source, "Form Guid")
/** RETRIEVE OTHER SETTINGS HERE **/
};
pipelineStep.AddPlugins(batchEntryStorageSettings, formSettings);
}
}
}
7. Create the following class ReadFormDataStepProcessor
This class effectively reads form data from the ExperienceForms table and places a collection of FormModels in the Iteratable Context. Which will be consumed by a future pipeline.
using System;
using Sitecore.DataExchange.Attributes;
using Sitecore.DataExchange.Contexts;
using Sitecore.DataExchange.Models;
using Sitecore.DataExchange.Plugins;
using Sitecore.DataExchange.Processors.PipelineSteps;
using Sitecore.ExperienceForms.Data;
using Sitecore.Services.Core.Diagnostics;
using Sitecore.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using YourNameSpace.Models;
namespace YourNameSpace.PipelineSteps
{
[RequiredPipelineStepPlugins(new Type[]
{
typeof(FormSettings)
})]
public class ReadFormDataStepProcessor : BasePipelineStepProcessor
{
private IFormDataProvider _formDataProvider;
private IFileStorageProvider _fileStorageProvider;
public ReadFormDataStepProcessor()
{
_formDataProvider = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();
_fileStorageProvider = ServiceLocator.ServiceProvider.GetService<IFileStorageProvider>();
}
protected override void ProcessPipelineStep(PipelineStep pipelineStep, PipelineContext pipelineContext, ILogger logger)
{
// These are read from pipeline root via ReadFormDataStepConverter
var formSettings = pipelineStep.GetPlugin<FormSettings>();
DateRangeSettings dateRangeSettings = pipelineContext.GetPlugin<DateRangeSettings>();
// FormGuid identifies a specific form template
var formdata = _formDataProvider.GetEntries(new Guid(formSettings.FormGuid), dateRangeSettings.LowerBound, dateRangeSettings.UpperBound);
var formModels = new List<FormModel>();
foreach (var item in formdata)
{
var newForm = new FormModel();
newForm.FormId = item.FormEntryId.ToString();
if (!string.IsNullOrWhiteSpace(newForm.FormId)) newForm.FormIdGuid = new Guid(newForm.FormId);
if (!string.IsNullOrWhiteSpace(newForm.FormId)) newForm.EnquiryEntity = new EntityReference("incident", newForm.FormIdGuid);
newForm.SomeProperty = item.Fields.Where(x => x.FieldName == "SomeProperty").FirstOrDefault()?.Value;
/** ADD OTHER PROPERTIES **/
/** EXAMPLE OF USING SETTINGS **/
newForm.ProcessType = new OptionSetValue(formSettings.ProcessType);
formModels.Add(newForm);
}
IterableDataSettings newPlugin = new IterableDataSettings(formModels);
string message = ((formModels.Count > 0) ? $"Forms read from manager. (total count: {formModels.Count})" : "No forms were read from manager.");
Log(logger.Info, pipelineContext, message);
pipelineContext.AddPlugin(newPlugin);
}
}
}
8. Create your pipelines
We will use the Sitecore Out-of-the-box tools to create all but one of the pipeline steps. Create two new pipelines as defined below:
Read Forms Pipeline
Add dynamics queue Create Entity Queue Pipeline Step
Sey use delta settings Set Use Delta Settings Pipeline Step
Read Form Data [Custom***]
Iterate and run pipelines Iterate Data and Run Pipelines Pipeline Step(Add process single form pipeline to this step)
Submit entities to dynamics Submit Remaining Entities From Queue Pipeline Step
Process single form pipeline
Read single form model Copy Object from Context to New Location Pipeline Step
Resolve dynamics entity Resolve Dynamics Entity By Identifier Pipeline Step(Point the identifier value accessor at the forms guid in source model, then use Guis as a string value reader)
Apply mapping from form model to incident Apply Mapping Pipeline Step(Point to the mapping set from step 3)
Add incident to queue Add Entity to Queue Pipeline Step
9. The custom step
The custom step shown in the pipeline above, should be created using your new Read Form Data template. Specify the ItemId of the Form you are wanting to send, together with any additional settings. Add your converter and processor using your own namespace as appropriate: *Yournamespace.ReadFormDataStepConverter, Yournamespace*.
10. Create a pipeline batch
Create a new Pipeline Batch called Forms to Dynamics Sync in this location: Dyanamics Tenant/Pipeline Batches and add Read Forms Pipeline.
11. Run Pipeline Batch
Click the button to run the batch.
Debug
You are unlikely to get this working first time round. A good way to debug this process is to decompile the processor from Submit entities to dynamics step, create your own version and swap it in. Then place a breakpoint on the line where it calls dynamics:
crmServiceClient.Execute(executeMultipleRequest);
Here you can see the response from the dynamics call.
If your pipeline is not getting that far, then you can decompile the other processors in a similar way and step through those.
| Can I use Dynamics 365 for Sitecore Connector to send data from Sitecore Form directly to Dynamics 365?
I would like to use Sitecore Forms to collect data from my Sitecore website, then send that data directly to Dynamics 365 - using the Connector that is available from Sitecore.
I have looked for examples of how to do this online, but there doesnt seem to be any solid example of how to do this specifically for Sitecore forms. Most examples, including the sitecore documentation are dependent on XConnect. The closest example I could find synced contacts, together with events from each contacts interactions.
In my specific situation, I already have access to the users ContactId in Dynamics, so would like to create a simpler pipeline, that takes forms from the experience database (that have not been processed yet) and send them periodically to Dynamics.
Can anyone provide example of how this might be done?
| |
I have seen this error before when installing a newer .net version on an existing environment.
one think helped for me is to deploy on a clean folder or environment. By just placing it in the same folder can cause older files remain and still try to reference the old version.
Kind regards
| Sitecore Identity Server getting 500
Installed Sitecore Identity server 7.0 on the exiting sitecore instance(10.3). When I try to access the identity server directly from browser (https://idenityserver.local) I keep getting "500 Internal Server Error".
I ran the "dotnet .\Sitecore.IdentityServer.Host.dll" on PowerShell and seeing this
[11:36:43] Sitecore.Framework.Plugin.Web.WebCommand [Information] Starting web host
[11:36:43] Duende.IdentityServer.Startup [Information] Starting Duende IdentityServer version "6.0.4+9dfb7e94e795f86sdfs586sdf70aae05e4e07" (".NET 6.0.2")
[11:36:43] Duende.IdentityServer.Startup [Information] Using the default authentication scheme "idsrv" for IdentityServer
[11:36:43] ConfigurePipeline [Error] Pipeline completed with error
System.Exception: Error processing block: System.Lazy`1[[Microsoft.AspNetCore.Hosting.IStartup, Microsoft.AspNetCore.Hosting.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]
---> System.ArgumentNullException: Value cannot be null. (Parameter 'source')
Seems like identity server and a version mismatch OR issue with the Microsoft.AspNetCore.Hosting.Abstractions package?
FYI - dotnet --info
Reason why I am getting this?
| |
To answer your question specifically: Regex.Replace(vacancy.Location, "(?<!&#xa;.*)&#xa;", ", "), where (?<!&#xa;.*) is a negative lookbehind assertion.
However, my recommendation is to avoid regex in favor of more readable methods such as:
ReplaceFirstOccurrence(vacancy.Location, "&#xa;", ", ");
private static string ReplaceFirstOccurrence(string source, string find, string replace)
{
int firstOccurrenceIndex = source.IndexOf(find);
if (firstOccurrenceIndex < 0)
{
return source;
}
string resultAfterRemoval = source.Remove(firstOccurrenceIndex, find.Length);
string resultAfterInsertion = resultAfterRemoval.Insert(firstOccurrenceIndex, replace);
return resultAfterInsertion;
}
| How to replace a link break (&#xa) with a comma using Regex
One of our clients have asked us to replace the first line break (&amp;#xa) with a comma.
So far the regex that we have for our location address is this:
Location = vacancy.Location.IsNullOrEmpty() ?
string.Empty :
Regex.Replace(vacancy.Location, "&#?[a-z0-9]+;", " ");
Can someone tell me how i can add another rule to the regex pattern which would replace only the first instance of &amp;#xa with a comma?
Thank you!
| |
We checked the SXA site manager first and that seemed all ok.
We patched the <siteResolving> config section to include all mvc sites and have them resolve after the SXA site(s). This works and shows in the SXA site maneger, but it does not solve the issue.
What did solve the issue is adding a targetHostName in the site definition of the SXA site. After doing that, suddenly the site resolving in the navigation bar was ok.
To be honest, I didn't have the time yet to investigate why this is the case. But as it solved an annoying issue for us I decided to share it here as it might help someone else. Or maybe someone actually knows why - please share if you do, I am still curious ;)
| XP editor navigation bar not working in SXA site
We inherited a solution that consists of a number of sites build with MVC. The solution has been upgraded to 10.2(.1) and we have added a new headless site using SXA and JSS. So we have a dozen "regular" sites and 1 SXA site.
We noticed that we have an issue in the experience editor when using the navigation bar in the SXA site. Apparently the site resolving is not correct on that part as it links to the first non-SXA site it can find.
The url when the editor opens is like /?sc_mode=edit&sc_itemid=...&sc_lang=en&sc_version=1&sc_site=portal.
But when we then use the navigation bar to go to another page we get an error because the sc_site parameter in the url is wrong:
/site1/?sc_mode=edit&sc_itemid=...&sc_lang=en&sc_site=site1&sc_ee_fb=false.
When we manually change the sc_site parameter the page works.
How can we get the navigation bar to use the correct site?
| |
you can start with the Sitecore documentation about XM Cloud development at https://doc.sitecore.com/xmc/en/developers/xm-cloud/index-en.html
There is a section for Sitecore ASP.NET Rendering SDK API, that may help you with a .Net reference.
I recommend you clone the Git Repo for the XM Cloud Foundation at https://github.com/sitecorelabs/xmcloud-foundation-head/, it is the base NextJS application for start developing in XM Cloud.
Related to how to call an external API, when you create a NextJs component you can use the fetch() function to get data from external APIs easily.
Hope it helps, and if you need further support, don't hesitate and find me in Slack.
| How to get data from an API using XM Cloud
I am new to Sitecore products and my company has just purchased XM Cloud. I have gone through tutorials and classes about how to create and edit a site but I still do not understand how I can get data from an external source, like an API that I write, and have that data injected into the website pages.
In my instance, we have a catalog of thousands of products to display. How do I create a component that will display product names and prices so that I can list them on a catalog page, limiting the subset of products based on user search terms or menu selection?
I have looked a little bit into item buckets, but that seems to be a system for setting up the entire inventory in Sitecore, which I do not want to do because our inventory of parts is constantly changing and prices are customized to each customer anyway. Can someone explain the best practices for this, ideally with ASP.NET, or point me to some resources that specifically deal with XM Cloud and how to achieve this? Thank you.
| |
You can also import Excel files from the Products section as well, following the steps -
Click on Products from Menu
Then click on the + Add button
Click on the Import Excel button
Import your required excel here -
Make sure the Excel sheet name should be "M.Asset"
| Import excel component not visible in Content Hub for creating bulk assets
I followed the article Migrate sitecore media library to DAM and update the media links in Sitecore for importing the assets in the Content Hub using the excel file but when I reached the step to import the excel then I got to know that I was unable to see the import excel option in my content hub.
Later on, I followed the https://doc.sitecore.com/ch/en/users/content-hub/configure-content-hub--creation.html link to configure the import excel component but I see the following screens and nowhere I can configure the import excel option.
Then I don't see the expected result for adding the required component, but I see the following screen:
FYI: I am using Content Hub 5.0
| |
I can see ERR_SSL_KEY_USAGE_INCOMPATIBLE error message on your screenshot.
I found and article from Εukasz SkowroΕski, explaining how to fix the issue here:
http://sitecore.skowronski.it/sitecore/sitecore-and-err_ssl_key_usage_incompatible-error-in-the-browser-windows-11/
In nutshell:
Open IIS Manager
Find your site
Edit bindings
Check Disable TLS 1.3 over TCP checkbox
Restart IIS
| Successfully installed Sitecore XP 9.3, but seeing browser error ERR_SSL_KEY_USAGE_INCOMPATIBLE
I have successfully installed Sitecore XP 9.3 , but when launching the URL facing issue.
The browser error is: ERR_SSL_KEY_USAGE_INCOMPATIBLE
Not finding any error in logs, unable to understand what is the issue.
| |
Looks like you are using SIF 2.1.0 , For Sitecore 9.1.0 try using SIF 2.0.0 It should work.
Install-Module -Name SitecoreInstallFramework -RequiredVersion 2.0.0
Hope this helps!!
| Solr fails to restart during Sitecore 9.1 SIF installation
I'm installing Sitecore 9.1.0 locally using SIF and it reaches about step 70 of 85, then fails with the error
Could not complete request for https://localhost:8984/solr - Unable to
connect to the remote server
This is the message in the console window:
[---------------------------- SitecoreSolr_CreateCores [1] : ManageSolrCore ------------------------------------------]
[SitecoreSolr_CreateCores [1]]:[Requesting] https://localhost:8984/solr
WARNING: [1/5] Request Failed: Unable to connect to the remote server
[SitecoreSolr_CreateCores [1]]:[Requesting] https://localhost:8984/solr
WARNING: [2/5] Request Failed: Unable to connect to the remote server
[SitecoreSolr_CreateCores [1]]:[Requesting] https://localhost:8984/solr
WARNING: [3/5] Request Failed: Unable to connect to the remote server
[SitecoreSolr_CreateCores [1]]:[Requesting] https://localhost:8984/solr
WARNING: [4/5] Request Failed: Unable to connect to the remote server
[SitecoreSolr_CreateCores [1]]:[Requesting] https://localhost:8984/solr
WARNING: [5/5] Request Failed: Unable to connect to the remote server
Install-SitecoreConfiguration : Could not complete request for https://localhost:8984/solr - Unable to connect to the remote server
At C:\Sitecore\Sitecore 9.1.0\XP0-SingleDeveloper.ps1:74 char:1
+ Install-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Objec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
Invoke-ManageSolrCoreTask : Could not complete request for https://localhost:8984/solr - Unable to connect to the remote server
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.1.0\Public\Install-SitecoreConfiguration.ps1:641 char:25
+ & $entry.Task.Command @paramSet | Out-Default
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-ManageSolrCoreTask
I've set up Solr 7.2.1 successfully (using the usual NSSM tool) and can start and stop the service via the windows services utility without any issues. I can also view the Solr dashboard in the browser and see and manage cores etc. I presume there must be something wrong in how Solr is set up though which causes this issue. I checked the Solr logs for any issues, but they don't show any errors.
| |
There may be many reasons for this, please verify the below points if there is no data present on the Sitecore experience profile dashboard.
Make sure the xConnect Service is running.
Make sure to Enable the indexing of anonymous contacts in the xDB index. (refer)
Make sure you have published the goals and also other pages where you associated the goals.
To validate Experience Profile just wait for 10-15 minutes or close the Session (see this guide for how to speed up the Session spoofing and close cycles).
You can lower the default session timeout to 1 minute as given here then the visit to a page (that has a goal associated with it) in incognito mode, close the browser window.
After 1 minute, if everything works fine then it should populate that data in Experience Analytics and also in Experience Profile.
Hope it hepls!
| Goals data not available in Experience Profile
Using Sitecore 10.1.2 on PaaS.
All the custom Goals are published and they are associated with respective page items.
I have browsed those pages, closed the browser.
There is no data available here.
This is our UAT environment. But I can see the data in the DEV environment.
Is there any configuration setting that I should check to fix this.
| |
The processing is one of the Server roles used for Extracting information from captured, raw analytics data and transforming it into a form suitable for use in reporting applications.
Rule-based configuration allows you to quickly set up a role without having to manually enable and disable individual configuration files. Rule-based configuration values are set in the web.config file.
You can specify single or combined role using web.config.
<add key="role:define" value="ContentManagement" />
Combining roles
<add key="role:define" value="Processing,Reporting" />
So check your environment find the processing role and then apply the web.config changes to it.
Reference: https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/rule-based-configuration.html
Hope it helps!
| What is the "Processing role?"
I'm patching form Sitecore 10.2.0 to 10.2.2, and in documentation it has the following line:
Updating Web.config on ContentManagement/ContentDelivery/Processing roles
I know what CM and CD are, but I'm less familiar with this "Processing" role. I know xConnect has a "processing engine" Windows service located in the \App_Data\jobs\continuous\ProcessingEngine folder, but it has no web.config. Any idea where this web.config for the Processing role is located?
| |
I've seen a very similar problem with forms data not being saved occasionally. It was caused by Sitecore Forms bot detection functionality blocking some of the submit actions. In most cases the issue is somewhere in Sitecore tracking and visitor identification, because in order to classify a visitor as a bot or human, Sitecore needs to have access to the current session tracker, user's contact ID and be able to run visitor identification script.
Even though disabling bot detection can be a quick workaround, I would recommend investigating why real users are mistakenly blocked by bot detection.
To answer your questions:
Is there any firewall bot detection at the Azure side for Sitecore Managed Cloud platforms? If yes, can we disable it?
An App Gateway or CDN with web application firewall (WAF) can be configured in front of Sitecore infrastructure, but if a formbuilder.aspx request was blocked by the WAF, you would not even see it in the app service logs.
To add to my confusion, there are two "bot detection" features in Sitecore:
Yes, bot detection for forms can be enabled/disabled on two levels:
for the entire form by setting the Robot detection enabled checkbox on the form level
for each submit action separately by setting the Enable Robot Submission checkbox on the submit action level
By default bot detection is enabled for all forms and for those submit actions that involve saving data. This is why the redirect to "Thank You" page works fine even for bots - bot detection is usually disabled for this submit action. However, it makes it difficult to spot this problem because in the front-end all form submissions seem to be successful.
Tried some submissions and all were successful, but I'm not sure which of the fixes fixed this.
Either of these checkboxes will help, disabling bot detection on the form level disables it for all submit actions automatically.
Both features look similar. When to use which one or one over other or both?
If you want to disable bot detection for all submit actiona, you can do it on the form level. If you want it to be enabled for the form, but block only specific form actions, for example, sending emails, pushing data to a DB or CRM, then you should use the action-level checkbox.
Is there a way such bot submissions are logged anywhere in Sitecore?
Unfortunately no, by default this form data will not be logged in Sitecore, unless you have some custom code that saves this information.
Any way I can troubleshoot or isolate the issue?
Yes, start from checking the cookie SC_ANALYTICS_GLOBAL_COOKIE. If it's missing, then bot detection will block the form submission. For example, I've seen situations when cookie consent modules or custom pipelines were removing SC_ANALYTICS_GLOBAL_COOKIE and it resulted in lost form submissions. Another potential reason is missing tag @Html.Sitecore().VisitorIdentification() in some of the layouts.
If the cookie exists, look at the second part of it after the | character - it's called IsClassificationGuessed and contains a true or false value. If false, it means that the website has not been able to verify whether the user is bot or not so make sure that the script /layouts/system/VisitorIdentification.js loads and runs as part of the visitor identification tag for new contacts.
Potential season for users being classified as bots:
Their user agent is flagged as bot by Device Detection
Their IP address is listed in <excludedIPAddresses> config
The script /layouts/system/VisitorIdentification.js did not load in the browser or did not detect any mouse movements/touch screen actions
Here are some helpful Sitecore documentation pages with additional details:
Work with robot detection for forms
Robot detection overview
Visitor identification using the robot detection component
| Sitecore form submissions are inconsistent
We are using Sitecore 10.1.3 on Managed Cloud.
The website has a Sitecore form with two Submit Actions - Call_API & Show_Success_Page.
The Call_API action calls our applications custom back-end method Execute, which has line-by-line logging right from its first line and it includes the data being sent to the API and also the response received from API.
Based on the external API database data, we have realized that only some form submissions are captured there.
Irrespective of the submission success/failure, the visitor would still see the "Success Page", as this second submit action is a redirection without any validation.
On checking the logs in Azure App Insights, the custom logs are available only for some of the submissions.
When a visitor, submits a form, in the browser's network tab, we can see that the first request will be for the default formbuilder?...., which is logged by Sitecore also.
In the logs, for the missing submissions, even formbuilder?.... log is unavailable. For the successful submissions all the custom logs are being logged.
Looks like the Execute method itself is not being hit!
Seems like, somehow on the form's submit button hit, it is assuming a success (or return true) and then proceeding to the next submit action without even hitting the back-end code.
Is there any firewall bot detection at the Azure side for Sitecore Managed Cloud platforms? If yes, can we disable it?
To add to my confusion, there are two "bot detection" features in Sitecore:
One is in the Submit Action item - Enable Robot Submission - Select to allow bot form submission
and another, for the Form item - Is Robot Detection Enabled.
I have disabled Is Robot Detection Enabled and also cleared cache at /sitecore/admin/cache.aspx.
Tried some submissions and all were successful, but I'm not sure which of the fixes fixed this.
Could you please help me understand, if any of those "bot detection" features could be responsible for this issue.
Both features look similar. When to use which one or one over other or both?
The concern is, there could be valid submissions which did not go through because a bot detection was enabled.
Is there a way such bot submissions are logged anywhere in Sitecore?
Any way I can troubleshoot or isolate the issue?
Thank you
| |
This is the solution that worked for me
Create a Custom Command: Create a new class that inherits from
Sitecore.Shell.Framework.Commands.Command and implement the necessary
logic for your button.
using Sitecore.Shell.Framework.Commands;
public class MyCustomCommand : Command
{
public override void Execute(CommandContext context)
{
// Your custom logic here
}
public override CommandState QueryState(CommandContext context)
{
return CommandState.Disabled;
}
}
Configure the Command in Sitecore: Create an XML configuration file in your Sitecore solution, e.g., MyCustomCommand.config, to define your command. Place this file in the App_Config\Include folder.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<commands>
<command name="mycustomcommand" type="YourNamespace.MyCustomCommand, YourAssembly" />
</commands>
</sitecore>
</configuration>
Add command to your button
| Grey out content editor ribbon button
Is there any way to grey out the content editor archive button for all Sitecore items for every user
It should look like this
| |
To configure Item and Data cache values, create a patch file for cache size values. For example, custom.caching.config and add the following
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<databases>
<database id="web" role:require="ContentDelivery or Standalone">
<cacheSizes>
<data>1000MB</data>
<items>1000MB</items>
</cacheSizes>
</database>
<database id="master" role:require="Standalone or ContentManagement">
<cacheSizes>
<data>1000MB</data>
<items>1000MB</items>
</cacheSizes>
</database>
</databases>
<settings>
<setting name="Caching.AccessResultCacheSize">
<patch:attribute name="value">10000</patch:attribute>
</setting>
</settings>
</sitecore>
</configuration>
Refer to this document for more details.
Add this patch for the prefetch cache size.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<caches>
<cache name="prefetch">
<param desc="Size (MB)">50MB</param>
</cache>
</caches>
</sitecore>
</configuration>
Hope it helps.
| how to create patch for changing cache size limits in sitecore config
Using Sitecore 10.0.1
I need to change the Prefetch and AccessResultCacheSize to 500 MB
The Prefetch cache size is set as below in one config file
<prefetch hint="raw:AddPrefetch">
<sc.include file="/App_Config/Prefetch/Common.config" />
<sc.include file="/App_Config/Prefetch/Master.config" /></prefetch>
Inside the Master.config file, the below code is written
<?xml version="1.0" encoding="utf-8" ?><configuration<cacheSize>300MB</cacheSize </configuration>
And, AccessResultCacheSize is set as below in xyz.config
<?xml version="1.0" encoding="utf-8"?>
<settings>
<setting name="Caching.AccessResultCacheSize" s:value="50MB" /></settings></sitecore>
How to write patch file to change both above values to 500 MB
| |
The OOTB RSS feed functionality is MVC only. It is not supported in headless JSS. If you want an RSS feed, you need to implement the functionality yourself in the head application.
| RSS Feeds in NextJS Application
We've got a Sitecore headless project using NextJS. I've setup an rss feed using the OOTB Sitecore RSS functionality and it seems to be generating the correct xml when I view it through EE or preview.
The issue we have is that our front end is a JSS application using NextJs. If I navigate to the rss url using the front end it just renders a blank page. My initial thought was a rewrite to the backend url in the NextJS application but that returns a not found 302 error.
Is there a simple way (something built in to JSS?) to have the rss feeds be visible from the front end in a JSS NextJS application?
| |
Create Specific Components
In this case, it seems reasonable to create specific components that only deal with image / link / multilist fields. This is a common pattern in the builds that I have seen (Vue, Next, and Angular).
As was mentioned in the comments of the original question, type assertions aren't possible in Angular templates, but you can handle these issues in your component TS code instead of the template:
import { Component, Input } from '@angular/core';
import { ComponentRendering, ImageField, LinkField } from '@sitecore-jss/sitecore-jss-angular';
export class MyComponent {
@Input() rendering: ComponentRendering;
get backImage(): ImageField | undefined {
const field = this.rendering.fields.BackImage;
if (this.isImageField(field)) {
return field;
}
return undefined;
}
get backLink(): LinkField | undefined {
const field = this.rendering.fields.BackLink;
if (this.isLinkField(field)) {
return field;
}
return undefined;
}
private isImageField(field: any): field is ImageField {
return field && typeof field.src === 'string';
}
private isLinkField(field: any): field is LinkField {
return field && typeof field.href === 'string';
}
}
Then use the getters instead of directly accessing the rendering.fields. The ngIf directives ensure that elements are only rendered if the corresponding fields are 1. available and 2. the correct type:
<img *ngIf="backImage" class="imgSize"
*scImage="backImage"
[alt]="backImage?.value?.alt" />
<span *ngIf="backLink" *scGenericLink="backLink" class="back-link"></span>
Extend Existing Types in .d.ts
You should also be able to extend the types in your own .d.ts file. For example:
import { ComponentRendering, Field, ImageField } from '@sitecore-jss/sitecore-jss-angular';
export interface MyComponentFields extends ComponentFields {
BackImage: ImageField;
BackLink: LinkField;
}
export interface MyComponentRendering extends ComponentRendering {
fields: MyComponentFields;
}
Then use MyComponentRendering instead of ComponentRendering.
Sample Application
Take a look at the sample app if you haven't already:
npx create-sitecore-jss@ver<version-number> angular [--appName <your-app-name> --fetchWith [REST| GraphQL]]
You may be able to glean some insights from there. For example, regarding setting the alt attribute of images, you can try this:
export class MyImageComponent {
@Input() rendering: ComponentRendering;
// this pattern can be used with the 'attrs' arg to the link to inject dynamic attributes from code
linkDynamicAttributes = {
alt: "xxxxxxxxx", // This is where you would do the type checking and value population
};
}
Usage:
<img *scImage="rendering.fields.myField; attrs: alt"/>
If you see an area for improvement, submit a pull request!
Additional Insights
You can also check out the issues section of the JSS repo. There are numerous items which may provide additional insights / ideas. For example:
https://github.com/Sitecore/jss/issues/1020
https://github.com/Sitecore/jss/issues/1344
Last Resort
If all else fails and you need to hack a solution by modifying node_modules, I recommend using the patch-package node module (props to Corey Smith for making the Sitecore community aware of this).
| Numerous type errors when enabling strictTemplates in Angular 15
I would like to enable strictTemplates in angular but when I do I am getting some of the following type errors.
By default most of our rendering variables are using ComponentRendering Type from JSS, but see the errors I am getting. How would I resolve these?
For example in one of my html template...
Given that rendering variable is of type:
rendering: ComponentRendering;
Then in my page(html template) I have this:
<img class="imgSize"
*scImage="rendering.fields.BackImage"
[alt]="this.rendering.fields.BackImage.value.alt"
/>
<span *scGenericLink="rendering.fields.BackLink" class="back-link"></span>
I am getting the following errors:
For *scImage:
Type 'Field | Item | Item[]' is not assignable to type '"" | ImageField'
For [alt]: Property 'value' does not exist on type 'Field | Item | Item[]'.
Property 'value' does not exist on type 'Item'.
For *scGenericLink: Type 'Field | Item | Item[]' is not assignable to type 'LinkField'.
Type 'Field' is not assignable to type 'LinkField'.
Types of property 'value' are incompatible.
Type 'GenericFieldValue' is not assignable to type 'LinkFieldValue'.
Type 'string' is not assignable to type 'LinkFieldValue'
::::PLEASE NOTE:::::::
I have tried messing around with the typings file in jss to no avail.
Example: in node_modules/@sitecore-jss/layout.models.d.ts:
export interface ComponentFields {
[name: string]: Field | Item | Item[] | any; //adding any here makes all issues go away...
}
But I know this is not correct practice to alter the node_modules contents. So my question is the implementation incorrect by using rendering: ComponentRendering for everything? Or how can I add custom types to get around these issues? Like maybe extend the type in my own d.ts file etc. Thanks in advance!
| |
By default, Device Detection is enabled for Standalone, Content Delivery and Processing Servers. So first of all ensure that you are not testing on the front end of a Content Authoring server.
You should also make sure that Device Detection is being initialised properly. To do this, check the logs on your CD server and scan for the first occurence of:
Device detection - initializing
If there are any issues, then you will see an exception shortly after this line. A couple of reason I have experienced that will cause it to fail to inialize are:
Visual C++ runtime is not installed
Incorrect FiftyOne.DeviceDetection binaries for your operating system (i.e. 32 bit, when it should be 64 bit).
To check if a binary is 32 or 64 bit, you can open the DLL in notepad, search for the first occurence of the letters PE.
If it is followed by L then it is 32 bit
If it is followed by dβ then it is 64 bit
I believe you can run with certain DLLs that are 32 bit, but certain ones must match the operating system. In my situation, all FiftyOne.DeviceDetection binaries were fine as 32 bit (i.e. had the L when inspected) but the FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll needed to be 64 bit.
If you are running on 64 bit, please open that in notepad and confirm if it has PE dβ
UPDATE
Based on the error message you have added to your question, it seems the issue may infact relate to Geo IP lookup service, which is separate to device detection.
Please try signing up for the free subscription and linking up in your config as per the instructions on this page: https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-manager/set-up-sitecore-ip-geolocation.html
| Device detection and sitecore forms
We are facing an issue with device detection and sitecore forms.
In the presentation details of our page, we have added MVC Form rendering and added a form in the datasource for "mobile" device.
It works perfectly in the simulator in chrome/IE but it is not loading correctly on my mobile device (Samsung Galaxy/Android).
Device detection is enabled by default. Can anyone please suggest what could be the issue?
I can also see below error in logs -
ERROR Failed to perform GeoIp lookup for 45a56cae-a85c-2cb4-55ec-639c7150f64f
Exception: System.Net.WebException
Message: The remote server returned an error: (403) Forbidden.
Source: System
at System.Net.HttpWebRequest.GetResponse()
at Sitecore.CES.Client.WebClient.<>c__DisplayClass6_0.<ExecuteRequest>b__0()
at Sitecore.CES.Client.WebClient.Execute[T](Func`1 action, String requestUri)
at Sitecore.CES.Client.ResourceConnector`1.Request(String endpoint, Object[] parameters)
at Sitecore.CES.GeoIp.SitecoreProvider.GetWhoIsInformationByIp(String ip)
at Sitecore.Analytics.Lookups.GeoIpManager.GetDataFromLookupProvider(GeoIpHandle geoIpHandle)
Sitecore version - 9.3
| |
You seem to be confusing some terminology.
A Publishing Target is a database. Out of the box, sitecore comes with one publishing target called Web. When you perform a publish and select a target, a copy of all 'publishable' items are copied from the master database to that target database.
To create a new publishing target, you need to first create a new database, add a new connection string, then add the target in the content editor. A preview target is a special type of publishing target (which you identify by checkbox when creating it in content editor) that sits outside of standard workflow behaviour.
You mention copying CM docker compose instructions and removing master connection string. What you are describing here is creating a second instance (CM). When viewed in front end, this will display data from the web database (identical to first CM). To display info from the new preview target, you need to update the web connection string on the new instance, to point to the new database.
You then mention custom indexes, yet have provided no information about how you have set these up.
When setting up a custom index, you can specify which databases that are crawled to create the index. So if you wanted one that only shows data crawled from your preview database, then you would need to configure a new one to point to the preview database or add preview to existing one and tailor your solr query accordingly to choose which database.
Apologies if I have misunderstood your question, if so please more details showing exactly how you have setup the custom index.
UPDATE
First of all, I suggest searching the main log file on your preview instance to see if there are any exceptions relating to the setting up and connewction of SOLR.
Second, navigate the config files and ensure the exact same SOLR config files are in place and that there are no role based exclusions (i.e. if the configs are for contentmanagement only and you have somehow changed the orole in web.config).
Finally, if the component you are using to call the index has no dependencies on data from the preview publishing target (i.e. DB), then it should be producing the exact same queries.
To confirm this, please navigate to the page with the component on it, then check the search.log file. The last log shown there should show the last query sent to solr from your application. This should be identical on both your CM and Preview instances.
If it is not, then the component has beeb built to call a different query, or it is somehow being influenced by what has been published to the preview database.
You can compare each query directly on the solr dashboard, by going to dashboard => select core => query ? then paste in query into the URL.
| New publishing target based CD server is not showing index data
In docker, I created the new publishing target as preview and set the new container by copying the docker-componse instructions of the CM service and removed the master connection string from this, and solr.search connection string is the same for the both CM and preview.
Now when I load a page that consumes the data from my custom index it loads fine on the CM but on the same page I check on the preview, it is not fetching the data from it.
FYI: I have logged the data to check which index is being read by the API so on both, the CM and preview, the same index is being consumed and although the solr.search connection string is still the same but the data is not coming.
Environment: Sitecore 10.3 based on docker
EDIT-1: I did not create the new indexes like sitecore_preview_master_index, sitecore_preview_web_index, etc., instead I will use the same indexes that are being used for the CM, e.g., sitecore_master_index, sitecore_web_index, and for achieving this I have kept the same solr.search connection string for CM and the new preview CD.
Summary:
CM -> Pointing to mysite.master DB -> domain: https://cm.mysite.com
CD -> Pointing to mysite.web DB -> domain: https://cd.mysite.com
new Preview CD -> Pointing to newly created mysite.preview DB -> domain: https://preview.mysite.com
| |
You can use $field.ContainsStandardValue as follows:
function Find-UnlinkedFields {
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[Sitecore.Data.Items.Item]$ClonedItem
)
if (-not $ClonedItem.IsClone) {
Write-Host "Item is not a clone"
return
}
$unlinkedFields = New-Object System.Collections.Generic.List[Object]
foreach ($field in $ClonedItem.Fields) {
# OPTIONAL: skip standard fields. Could also perform other checks such as $field.Shared and $field.Unversioned
if ($field.Name.StartsWith("__")) {
continue
}
if ($field.ContainsStandardValue) {
continue
}
$unlinkedFields.Add($field)
}
return $unlinkedFields
}
$unlinkedFields = Find-UnlinkedFields -ClonedItem (Get-Item -Path "master:/sitecore/content/path/to/clone")
$unlinkedFields | Format-Table -Property Name, Value
More information:
https://doc.sitecore.com/xp/en/developers/92/sitecore-experience-manager/determine-if-a-field-contains-standard-values.html
| How to find unlinked fields on a clone?
I am writing a Sitecore PowerShell Extensions script to determine which fields on a cloned item are unlinked from its original item. The easiest check is to compare the field value of the original and the cloned item. However, it is possible for the fields to have the same value but be unlinked, such as when the cloned item field is modified, saved, and then edited to be the same value as before.
What would the script look like?
| |
I checked closely for one day all the custom configurations specific to the custom indexes and related to the new publishing target and got to know that some configs should have been there on the new publishing target but they were not.
The reason was that the configs were created by custom rule based patching and that rule was not matching due to the incomplete configuration and somewhere error was coming while reading the data from the sxa index.
So I modified the rule so that it patched on the newly publishing target correctly and then it all worked.
| SXA search result API is not giving the result for the custom index on newly setup preview CD based on publishing target
We have created the custom indexes on the newly set CD server based on the new publishing target using docker. Please quickly check one of the posted questions to get an idea of how I've set up the new publishing target-based CD.
We have modified the default index resolver of the OOB search in such a way that based on the scope used on the searchresults rendering we are getting the index name from the CMS according to the key-value pair like:
scope1 : sitecore_scope1_index
scope2 : sitecore_scope2_index
Below are the LOCs that we are using to check if the index exists and then get the index
if (indexName != null && IndexExists(indexName))
{
return ContentSearchManager.GetIndex(indexName);
}
protected virtual bool IndexExists(string indexId)
{
Log.Info($"Resolving index contentSearch/configuration/indexes/index[@id='" + indexId + "']", this);
return Factory.GetConfigNode("contentSearch/configuration/indexes/index[@id='" + indexId + "']") != null;
}
When IndexExists() method runs I get the following error in the logs:
3304 12:52:53 WARN Results endpoint exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Sitecore.ContentSearch.DefaultDocumentMapper`1.MapUsingSelectMethod[TElement](TDocument document, SelectMethod selectMethod, IReadOnlyCollection`1 virtualFieldProcessors, IReadOnlyCollection`1 executionContexts)
at Sitecore.ContentSearch.SolrProvider.Mapping.SolrDocumentPropertyMapper.Sitecore.ContentSearch.SolrProvider.Mapping.ISolrDocumentMapper<System.Collections.Generic.Dictionary<System.String,System.Object>>.MapToType[TElement](Dictionary`2 document, SolrDocumentMapperContext`1 context)
at Sitecore.ContentSearch.SolrProvider.SolrSearchResults`1.<GetSearchResults>d__21.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Sitecore.XA.Feature.Search.Controllers.SearchController.ProcessSearchItems(IEnumerable`1 items, QueryModel model)
at Sitecore.XA.Feature.Search.Controllers.SearchController.GetResults(QueryModel model)
Nested Exception
Exception: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: item
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
at Sitecore.Data.Managers.ItemProvider.ApplySecurity(Item item, SecurityCheck securityCheck)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String separator, ItemPathType type)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String from, String separator, ItemPathType type)
at Sitecore.Data.ItemPath.GetPath(Item currentItem, String from, String separator, ItemPathType type)
at Sitecore.Data.ItemPath.get_LongID()
at Sitecore.Caching.AccessResultCache.GetKey(ISecurable entity, Account account, AccessRight accessRight, PropagationType propagationType, Boolean includeAdditionalParameters)
at Sitecore.Caching.AccessResultCache.AddRecord(ISecurable entity, Account account, AccessRight accessRight, PropagationType propagationType, AccessResult accessResult)
at
Sitecore.Security.AccessControl.ItemAuthorizationHelper.SaveDescendantAccessToCache(Item item, Account account, AccessRight accessRight, AccessResult accessResult)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAccess(Item item, Account account, AccessRight accessRight)
at Sitecore.Security.AccessControl.AuthorizationProvider.GetAccess(ISecurable entity, Account account, AccessRight accessRight)
at Sitecore.Security.AccessControl.DefaultAuthorizationManager.GetAccess(ISecurable entity, Account account, AccessRight accessRight)
at Sitecore.Security.AccessControl.DefaultAuthorizationManager.IsAllowed(ISecurable entity, AccessRight right, Account account)
at Sitecore.Security.AccessControl.ItemAccess.CanRead()
at Sitecore.Data.Managers.ItemProvider.ApplySecurity(Item item, SecurityCheck securityCheck)
at Sitecore.Pipelines.ItemProvider.GetItem.GetLanguageFallbackItem.Process(GetItemArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Data.Managers.DefaultItemManager.GetItem(ID itemId, Language language, Version version, Database database, SecurityCheck securityCheck)
at Sitecore.Data.Managers.DefaultItemManager.GetItem(ID itemId, Language language, Version version, Database database)
at Sitecore.Data.Managers.ItemManager.GetItem(ID itemId, Language language, Version version, Database database)
I tried to use the SecurityDisabler() in IndexExist() method but even that did not help, and the same search result API works on the CM environment and gives proper results there.
The search result API that tries to get the index data is
https://preview.mysite.localhost//sxa/search/results/?l=en&s={1230D7E5-F409-410B-ACF0-A2C57B174A21}&itemid={34A4AD79-F824-4BB4-8FDA-FB6BB485D597}&sig=all-products&p=15&o=Is%20Featured%2CDescending&v=%7BC1CGH6BA-5F84-431B-8A6F-0B10628C6378%7D
and do not return the results but the same API (below) works on CM.
https://cm.mysite.localhost//sxa/search/results/?l=en&s={1230D7E5-F409-410B-ACF0-A2C57B174A21}&itemid={34A4AD79-F824-4BB4-8FDA-FB6BB485D597}&sig=all-products&p=15&o=Is%20Featured%2CDescending&v=%7BC1CGH6BA-5F84-431B-8A6F-0B10628C6378%7D
Any idea what can this be cause it doesn't work on CD?
FYI: I already checked the answer from the post on StackExchange but this suggests providing the entry of the custom indexes, in my case I have many custom indexes and we did not enter those on CM but still works.
| |
To delete the renditions already created from the Asset details page along with deleting the rendition from the Media Processing flow you will have to delete it from the M.Renditionlink as well by following the steps.
Mangange -> Entities-> M.RenditionLink-> look for the desired rendition and then click on details. You would see the delete button on the right hand side top
| How can we remove the renditions from the renditions list
In Content Hub how can we remove the renditions from the Renditions list on the Asset detail page that were deleted from media processing?
I have already tried refreshing renditions with all options, but it is not removing them from the rendition list.
CH Version : "4.0"
| |
It is difficult to say what is wrong without understanding how items are created. But this definitely looks related to access rights.
You start by comparing 2 item -
1st is created from Data Provider
2nd is the one created by content author that behaves as expected.
Then you can check it's Security field (Standard field). I suspect, you will find a difference here.
Then you will need to check your implementation that is setting this Security.
Hope this helps !
| Non admin users not able to lock and Edit Items which are getting generated by Data Provider
There is a Data Provider implemented in the solution which is creating items in my Sitecore solution from an SQL server database. The implementation was done by someone else so I am not too sure what exactly how it is implemented.
The items created by this data provider are editable using the Admin users but not by any non admin users. When editing these items using non admin users, the "lock and edit" link does not do anything.
The lock and edit functionality works fine for items that are not coming from data provider
Is there any configuration in Data Providers that can restrict non admin users from editing an item?
Sitecore version: 9.3 vanilla
| |
public static IEnumerable<Models.Product> GetProductList(ID itemId)
{
var childItem = GetChildItems(itemId.ToString());
IEnumerable<Models.Product> productList = new List<Models.Product>();
if (childItem != null)
{
productList = childItem.Where(x => x.Fields["ProductTitle"] != null)
.Select(y => new Models.Product
{
Name = y.Name,
Id = y.ID,
ProductTitle = y.Fields["ProductTitle"].Value,
ProductItem = y,
Version = y.GetChildren().InnerChildren
.Select(z => new ProductVersion
{
Name = z.Name,
Id = z.ID,
VersionItem = z,
ModuleList = z.GetChildren().InnerChildren
.Select(m => new ProductModule
{
Name = m.Name,
Id = m.ID,
TemplateId = m.TemplateID,
ModuleItem = m
})
})
});
}
return productList;
}
| How to get child items specific format
I need show the product and Version from the below folder structure. Please help to achieve on this.
Requirement Screen Shot
Sitecore Folder Structure
So far I wrote some code for review
var item = ItemHelper.GetChildItems("{D25F6421-4578-4EB2-8C6D-C9BE2C355099}");
public static IEnumerable<Item> GetChildItems(string itemId)
{
var sitecoreItem = Sitecore.Context.Database.GetItem(new ID(itemId));
if (sitecoreItem.HasChildren)
{
return sitecoreItem.GetChildren().InnerChildren;
}
return null;
}
var productList = item.Where(x => x.Fields["ProductTitle"] != null).Select(y =>
new Product
{
Name = y.Name,
Id = y.ID,
ProductTitle = y.Fields["ProductTitle"].Value,
Version = y.GetChildren().InnerChildren
});
I need version list also to bind.
| |
This problem can occur when you have different versions of the CLI involved in the process. Older versions serialize "$name" as "_name". Newer versions serialize "$name" as "#name". Ensure that you are using the same version locally when you serialize, in the Build Pipeline when you create the package, and in the Release Pipeline when you deploy the package.
Unless you wrote the pipelines to pull a specific version of the CLI, it's pulling the latest. So unless you've been updating your local CLI version, it's probably using an older version.
Run the following commands locally, reserialize your items, create PR, and try the deployment again.
dotnet tool update sitecore.cli
dotnet sitecore plugin init --overwrite
| Getting error while deploying SCS $name item via AzDo pipeline: "Unable to find item data for $name"
We're working with Sitecore 10.2 and utilizing the Sitecore Content Serialization CLI. During the deployment of serialized items in the Dev environment using the Powershell SCS package installation (via the AzDO pipeline), we encountered the following error related to the '$name' item:
System.AggregateException: One or more errors occurred. (Unable to find item data for /sitecore/templates/Branches/Feature/My Sites/Product/Available Product Renderings/$name (<item's GUID>), flagged to be created, in source data store. This should never occur.)
2023-11-17T05:51:45.7575197Z ---> System.InvalidOperationException: Unable to find item data for /sitecore/templates/Branches/Feature/My Sites/Product/Available Product Renderings/$name (<item's GUID>), flagged to be created, in source data store. This should never occur.
Also, before syncing, Sync process is able to evaluate and discover this file:
2023-11-17T05:51:44.9024556Z [master] [A] /sitecore/templates/Branches/Feature/My Sites/Product/Available Product Renderings/$name (<item's GUID>)
Side Note: It works on perfectly on local machine.
| |
As per our discussion in chat, Here are the possible solutions to troubleshoot your issue.
You can check the assembly name in your Sitecore item
check if it was deployed to your solutions.
Check if the item is published.
Examine Sitecore logs for any error messages or exceptions related to your custom submit action. Ensure that the necessary logs are enabled in the Sitecore configuration.
Use the browser's developer tools to check for any JavaScript errors when submitting the form.
Inspect network requests to see if there are any issues with data being sent or received.
Double-check your Sitecore configuration files to ensure that the custom submit action is correctly registered.
Confirm that the form is configured to use the correct submit action.
Clear Sitecore and browser caches to ensure that you are not encountering caching-related problems
Hope this helps.
| Custom Submit Action Not Getting Called
Sitecore Version - 9.3
I have created a custom submit action but it is not working. It is not even getting called when I hit with debugger.
Submit Action Code -
using Sitecore;
using Sitecore.Data;
using Sitecore.Diagnostics;
using Sitecore.ExperienceForms.Models;
using Sitecore.ExperienceForms.Processing;
using Sitecore.ExperienceForms.Processing.Actions;
using System;
using System.Linq;
using System.Web;
using System.Collections.Generic;
using Sitecore.Analytics;
//using Sitecore.XConnect.Client;
//using Sitecore.XConnect;
//using Sitecore.XConnect.Collection.Model;
using Sitecore.Data.Fields;
using Sitecore.Resources.Media;
using Sitecore.Links.UrlBuilders;
namespace ProjectName.SitecoreForms.Actions
{
[CLSCompliant(false)]
public class SendEmailToCsd : SubmitActionBase<SendEmailActionData>
{
private ISubmitActionHelper _submitActionHelper;
private IVisitorTokensProvider VisitorTokensProvider { get; }
private static Guid PortalId
=> Context.Database.GetItem(Context.Site.RootPath).ID.Guid;
public SendEmailToCsd(ISubmitActionData submitActionData) : base(submitActionData)
{
VisitorTokensProvider = new VisitorTokensProvider();
}
public SendEmailToCsd(ISubmitActionData submitActionData,
ISubmitActionHelper submitActionHelper,
IVisitorTokensProvider visitorTokensProvider) : base(submitActionData)
{
_submitActionHelper = submitActionHelper;
VisitorTokensProvider = visitorTokensProvider;
}
private ISubmitActionHelper SubmitActionHelper => _submitActionHelper ?? (_submitActionHelper = new SubmitActionHelper());
/// <summary>
/// Execute method for custom submit action
/// </summary>
/// <param name="data"></param>
/// <param name="formSubmitContext"></param>
/// <returns></returns>
protected override bool Execute(SendEmailActionData data, FormSubmitContext formSubmitContext)
{
try
{
//logic goes here
}
catch (Exception ex)
{
Log.Error("Some error occurred while sending email to CSD ", ex, this);
return false;
}
}
}
}
Submit Action Item -
Can someone please suggest what I may have missed here?
| |
In order to start seeing boosted documents at the top of your search results, you should allow specific slots to display boosted items. Follow the steps below to mark slots as "boosted":
Go to the widget in CEC and select a widget variation.
In the widget variation rules, go the Strategy section (see the magic wand icon) and select the Slots tab:
For the first several slots, click the icon in the top right corner of each slot and switch it from Personalized to Boost:
Note: when we boost something under the Slots tab, we are not boosting specific documents, but instruct Sitecore Search to use slot #1, slot #2, slot #3, etc. for displaying boosted items according to the boosting rules. CEC UI may be slightly confusing here because the Slots tab shows actual documents from the index rather than generic boxes/placeholders, and it may feel like we are boosting specific items but it's not the case.
| Boosting rules do not work in Sitecore Search
I am trying to configure a boosting rule for my Search Results widget. The rule should boost documents with a specific value in one of the attribute. I have made this attribute available for boosting rules and added a boost rule for documents with the Offer equal to true.
Here is how my widget variation looks like in CEC:
and this is how the boost rule is configured:
When I try to get search results using React SDK or when I test this widget in the API Explorer, Sitecore Search does not apply any boosting and the documents that should be boosted do not appear at the top of the list.
Does boosting require any additional configuration? Have I missed any steps?
| |
After investigating various configurations on both Solr and xc-search roles, we identified that the problem stems from the Solr web app's IIS restriction on requests size.
To address this, we added the following lines of code to the web.config file of the Solr web app:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" maxUrl="32768" maxQueryString="32768" />
</requestFiltering>
</security>
</system.webServer>
This adjustment resolved our issue.
| xDB index rebuild gets stuck and get Request Entity Too Large exceptions
I encountered an issue during a manual trigger of an xDB index rebuild. The process appears to get stuck at approximately 7%, and despite waiting for hours, there's no further progress.
Upon inspecting the logs, we identified an exception related to the problem:
Response status code does not indicate success: 413 (Request Entity Too Large).
We are using Sitecore 10.3 into an Azure PAAS infrastructure with Solr 8.11.2 installed into an Azure web app.
Any insights or suggestions on how to address this would be greatly appreciated.
| |
For this to work, you need to provide target attribute in publish command.
It accepts list so as you have multiple target then provide them accordingly.
e.g.
get-item '/sitecore/content/path' | publish-item -target @('web','web.staging')
if it is single database then you can simple give it as string :
get-item '/sitecore/content/path' | publish-item -target @('web') or get-item '/sitecore/content/path' | publish-item -target 'web'
Hope this will solve your problem
| How to publish an item to multiple targets at a time, by using powershell script
I am working with Sitecore 10 and using powershell 6.2 version when trying to publish an item to multiple targets at a time, getting an error while using this SPE code:
Publish-Item -Item $item -Target "web","wed cd1"
| |
You can create a package using the Scripts wizard. Here are the steps you can follow.
Right-click on the item and go to Scripts -> Packaging -> Quick Download Tree as package.
Add all the package details and in the OTHER tab, you can choose to include media, template, layout, and workflows. Choose these options to include items linked.
This way you can include the linked items.
Hope this is what you need.
| Is there a quick way to include all dependent items in a Sitecore package
Currently, I would add item by item in the Package Designer.
Is there a way to add just the page item and it would include all its dependent/associated items in the package, e.g.: Templates, Datasources, Renderings, Media etc.?
Using Sitecore v10.3
| |
In order to do this I found I needed to pass an command argument -m in the web.config where the start command is issued like so:
<httpPlatform processPath="%HOME%\site\wwwroot\bin\solr.cmd"
arguments="start -p %HTTP_PLATFORM_PORT% -m 11g"
startupTimeLimit="20"
startupRetryCount="10"
stdoutLogEnabled="true">
This can be passed in megabytes instead if you prefer, e.g: -m 1024m = 1GB.
Note: I did try to see If I could change settings in: solr.cmd, solr.in.cmd and solr.in.sh to do this instead but couldn't get any of the changes to work so If you know a better way of doing this please comment or add another answer.
| How to set the JVM Memory for Solr running on an Azure App Service
If you are following one of these blog posts on setting up Solr in an Azure App Service (instead of an VM) such as: https://www.getfishtank.com/blog/installing-solr-app-service-in-sitecore-azure-paas, https://www.iamashishsharma.com/2020/11/install-solr-as-azure-app-service.html or https://sitecorediaries.org/2020/10/08/setting-up-solr-in-cloud-as-an-app-service/
All of them use the default setting for JVM memory (memory for the Java Virtual Machine) - which is 512MB. Generally this isn't enough for Solr in Production and needs increasing to a few GB. It will depend on how much you use search.
On our previous on-prem 16GB VM we had the JVM memory set to 11GB (around 70% of the RAM). I wasn't sure how to do this when running Solr in an Azure App Service though.
| |
Try to set the IncludeServerUrlInMediaUrls to false for the layoutservice you are using - something like this:
<layoutService>
<configurations>
<config name="default">
<rendering>
<renderingContentsResolver>
<IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
</renderingContentsResolver>
</rendering>
</config>
<config name="jss">
<rendering>
<renderingContentsResolver>
<IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
</renderingContentsResolver>
</rendering>
</config>
<config name="sxa-jss">
<rendering>
<renderingContentsResolver>
<IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
</renderingContentsResolver>
</rendering>
</config>
</configurations>
</layoutService>
This way you should get relative urls in the graphql output.
| The images or media from CD returns http instead of https on Sitecore
I have setup Sitecore JSS project from Getting Started template and I am using XP1 topology with CD and CM on separate containers to simulate actual production environment. However my problem is the images or media returns in HTTP instead of HTTPS, that will cause the images unable to load.
Below are the source returns:
It is working on CM and Experience Editor but it does not work when I publish and view from CD.
Snippet from rendering server, I print out the content of the fields:
| |
You have touched on an important aspect of XM Cloud that separates it from previous versions of Sitecore. XM Cloud is not the place to be serving custom APIs from, and not the place to be doing the kind of coordination that you are talking about.
The lead architect on the XM Cloud project has said:
"You should not be using XM Cloud as compute."
We can extrapolate that statement in numerous ways, one way being that the intended purpose of XM Cloud is to serve as a CMS -- not as a place where you host custom APIs.
What you are describing can be done in the "head" of the application (Next.js); specifically, Next.js API routes allow you to build a public API that runs on the server side. So if your API needs to make calls to other APIs, or perform sensitive operations, or run GraphQL queries against your content (perhaps via Experience Edge), you can do and probably should do that in the head.
My advice would be to get familiar with JSS+GraphQL. There are available features that may meet some of your requirements. For example, you can modify GraphQL schemas and hook external APIs onto them:
https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-headless-development/create-graphql-schemas.html
Lastly, if you can be more specific about what kind of APIs you want to build, that context may be helpful for other users in this community.
| Create custom RESTful API in XM Cloud
I am new to Sitecore products and my company has just purchased XM Cloud. We have the request to build a backend service to expose APIs so our frontend application (built in NextJS) consumes it. The purpose of APIs is acting as a proxy to forward request to 3rd APIs.
I'm wondering is it possible to do it in XM Cloud? Can I create new custom services in backend to achieve this? Or should I forward the request directly in NextJS? Because we want other clients to use that APIs to forward requests as well if possible. Would love to hear you guys thoughts. Thank you!
| |
Unfortunately Item Service search API is very limited.
It does not allow to use multiple templates in search query.
I checked if there is an option to create your own implementation of IItemSearch class, which is used to execute the search, but as far as I can say, it's hardcoded to use Sitecore.Services.Infrastructure.Sitecore.Data.ItemSearch class so nothing can be done in order to support multiple templates.
| Is Item service search API allow to filter by more than one template?
I am using Sitecore 10.2 and want to use Item service API to get items by template so in the facet I want to add more than one value in the template filter however I am unable to figure out the correct syntax to achieve that I tried something like this but it doesn't work:
"/sitecore/api/ssc/item/search?includeStandardTemplateFields=False&fields=ItemName%2CTemplateName&term=sitecore&facet=_templatename%7Cevent, banner
but when it filters by only one template it retrieves the results correctly.
Anyone faced this issue before?
| |
The issue you're experiencing might be related to how the GetDependencies pipeline works. When adding dependencies, it's crucial to ensure that you don't inadvertently create a circular dependency or trigger unnecessary updates.
Here are a few suggestions to avoid the update loop:
Check for Existing Dependencies:
Before adding a dependency, check if it's not already present in the args.Dependencies collection. If it's already there, avoid adding it again to prevent a loop.
if (parent != null && !args.Dependencies.Contains(new IndexableUniqueId<string>(parent.GetUniqueId())))
{
args.Dependencies.Add(new IndexableUniqueId<string>(parent.GetUniqueId()));
}
Ensure Dependencies are Unique:
Confirm that the unique identifiers used for dependencies are unique and consistent. If there's any inconsistency, it might result in the pipeline incorrectly detecting a change in the child item repeatedly.
Avoid Adding the Same Item as Dependency:
Check if the indexedItem is the same as the parent. If they are the same, it's unnecessary to add it as a dependency, as it could lead to a circular dependency.
if (parent != null && !item.ID.Equals(parent.ID) && !args.Dependencies.Contains(new IndexableUniqueId<string>(parent.GetUniqueId())))
{
args.Dependencies.Add(new IndexableUniqueId<string>(parent.GetUniqueId()));
}
Debugging:
Introduce logging or debugging statements to track the flow of the GetDependencies pipeline. This can help identify if there's an unexpected condition causing the loop.
Log.Info($"Processing item {item.ID} in GetDependencies pipeline.", this);
Review Parent Item Changes:
Ensure that updates to the parent item are appropriately triggering the GetDependencies pipeline without leading to a circular update.
By implementing these suggestions, you can enhance the reliability of your GetDependencies pipeline and prevent unnecessary update loops.
| Indexing.GetDependencies going into endless loop
I'm trying to make a parent page get reindexed when a certain child item updates via the Indexing.GetDependencies pipeline. So far it's picking up the target child item fine, but it then goes into a loop of believing the child item has been updated again and never tries to update the dependent item. Any idea what might be putting it into the update loop?
public class IndexEventOnDateUpdate : BaseProcessor
{
public override void Process(GetDependenciesArgs args)
{
Assert.IsNotNull(args.IndexedItem, "indexed item");
Assert.IsNotNull(args.Dependencies, "dependencies");
Item item = args.IndexedItem as SitecoreIndexableItem;
var realitem = item?.AsStronglyTyped();
if (realitem != null && (realitem is IBaseEventDetailDateItem || realitem is IBaseEventDetailDateOverrideItem))
{
Item parent = item.Axes.GetAncestors().FirstOrDefault(x => x.TemplateName == "Event Page");
if (parent != null) args.Dependencies.Add(new IndexableUniqueId<string>(parent.GetUniqueId()));
}
}
}
| |
The component folder in your Next.js app can be structured as you like. You should create folders in there to logically group your components.
For example, you can put the OOTB components into a folder, and create your own folders for things:
When you create the rendering, you just use the component name, you don't need to add a path in there. The component factory, builds the components from all *.tsx files under the ./src/components folder and builds a map using the name of the tsx file. This name is what gets matched to the field on the rendering item:
import { ComponentBuilder } from '@sitecore-jss/sitecore-jss-nextjs';
import * as CdpPageView from 'src/components/SXAComponents/CdpPageView';
import * as ColumnSplitter from 'src/components/SXAComponents/ColumnSplitter';
import * as Container from 'src/components/SXAComponents/Container';
import * as ProductDetail from 'src/components/SXAComponents/ProductDetail';
const components = new Map();
components.set('CdpPageView', CdpPageView);
components.set('ColumnSplitter', ColumnSplitter);
components.set('Container', Container);
components.set('ProductDetail', ProductDetail);
Best practice is just standard Next.js best practices. Group components logically, break things down to more manageable chunks if needed. Don't over complicate things. Aim for a clean maintainable set of components.
Important to note:
Helix does NOT apply for headless/XM Cloud. The helix folders still exist in the CM, but do not try to structure your code to follow this in your Next.js application. Just work with Next.js best practices.
| XM Cloud component organization location
how physically put a new(custom) SXA component for XM Cloud at different code folder structure and not to have all components under components folder ?
at Sitecore it is possible to use SXA modules, and helix structure but at the component lave is it not clear.
How to re-create the same structure and use components from different folders not only from the components level.
does anyone has some best practice advice already?
as I see for serialization modules it is possible to set different paths at sitecore.json, but for components, it is totally unclear.
or at rendering settings, I just put not name component but use full path instead?
| |
I noticed while reviewing the official SPE docs that it's possible to add custom links into the report.
Start by creating a script module containing your primary and secondary reports.
Contents of Second Report
Get-Item -Path "master:" -ID $parameter1 | Select-Object -Property * | Show-ListView -Property Name, ID, ItemPath
Contents of First Report
Import-Function Render-ReportField
Close-Window
$script = Get-Item -Path "master:" -ID "{6BC2FA09-3733-4B3F-9D6C-6F7FA8EE20D7}"
$props = @{
Property = @(
"Name",
"ID"
@{Label="More"; Expression={ Render-ScriptInvoker $script @{parameter1=$_.ID;} "Run Second Report" }.GetNewClosure() }
)
InfoTitle = "Report Reporter"
InfoDescription = "More details"
}
Get-ChildItem -Path "master:\content\home" -WithParent | Show-ListView @props
Notes:
The first report uses Render-ScriptInvoker to execute another script.
The expression takes the script item, parameters made available in the script, and the display text.
The use of GetNewClosure() is so that we can leverage $_ in the hashtable used for splatting with Show-ListView.
Not sure why, but using Show-ListView in the second report script required me to use explicit property names rather than relying on the default values or using *. SPE must be reusing a list of property names.
| How do you create a report of reports?
In SPE I need to create a report where each record has a link. When the link is clicked additional parameters are provided to the second report.
How would I go about creating such a report?
| |
I have an idea for you!
You can create an intermediate View Rendering that renders the Form programmatically with a custom datasource. This new rendering can be added or removed to any page. The datasource of this new rendering is the current item's Form field or another one (it gives you the flexibility to change the datasource anytime).
Your view should contain something like that:
@Html.Sitecore().Rendering("{6B5B0FE6-5C85-4487-BA7E-F8C2ECC186A8}", new { DataSource = "YOU_ITEM.Fields['YOUR_FIELD'].Id" }).
Where:
{6B5B0FE6-5C85-4487-BA7E-F8C2ECC186A8} is the id of the OOTB Form /sitecore/layout/Renderings/System/Forms/Mvc Form
You're free to implement the custom logic for the datasource in the Razor View
| sitecore query from field value
I'm trying to make Sitecore Forms easier for my content editors to use. They use the Content Editor and never touch layouts, controls, or renderings.
I've made an item template with a single droptree called "Form". It's data source is "/sitecore/Forms" This allows my content editors to select a form without going into presentation > details > edit > controls > Mvc Form > edit > Data Source > Browse, and missing a step and calling me when they break the page.
To get this to work, I need to set the Data Source of that control to a query that looks at the current item's "Form" field's value and uses the item linked as the Data Source for the control. What query do I need here?
If a query is not possible could I place a control into the layout before the "Mvc Form" control that reads the field's value and sets the datasource on the "Mcv Form" control?
| |
To understand this subject better, it's best if you learn how ASP.Net Membership works first using Microsoft documentation:
https://learn.microsoft.com/en-us/previous-versions/aspnet/tw292whz(v=vs.100)
The 3 tables you ask for, when you work with Sitecore:
aspnet_Users - it only stores users. The following columns:
UserId (to match with other tables),
UserName and
-LastActivityDatecolumns
are the only ones that most probably will be ever important to you.
aspnet_Profile table contains additional values for users. It has following columns:
UserId to match users from aspnet_Users table
PropertyNames containing names of the properties and their positions and size in other columns
PropertyValuesString - containing values of string properties
PropertyValuesBinary - containing values of properties which are not stored as strings.
aspnet_Membership table contains plenty of columns but you should be only interested in those:
UserId - to match users from aspnet_Users table
Password - encoded password
Email
IsApproved
IsLockedOut
Knowing that, when you create a new user, Sitecore creates entries in all 3 tables in one SQL transaction (or at least one right after another). It creates row for user details in aspnet_Users, stores password and email in aspnet_Membership table and saves some properties like first name and last name in aspnet_Profile table.
| Difference between aspnet_Users, aspnet_Profile and aspnet_Membership tables in Sitecore
Can someone please help me understand the use and difference between aspnet_Users, aspnet_Profile and aspnet_Membership tables in Sitecore?
And what sequence Sitecore follows to create user I mean does it 1st create user in aspnet_Users then Profile in aspnet_Profile and then uses aspnet_Membership?
| |
Please find the answer that I got from the Sitecore support 2 weeks ago.
Thumbnails are to be displayed instead of default icons while you select a page in Pages editor, and also in Explorer.
In case enabled for a website, Sitecore (re)generates a thumbnail for a page on each item save.
How to disable it?
You can disable generation of thumbnails on on three levels:
For a page:
Each SXA page has 'Generate Thumbnails' field on it under Appearance standard section
For your website, via the field on site grouping item.
By default this should be disabled.
In Sitecore.ThumbnailGenerator.config configuration file, for a whole instance.
| What is the use of Generate thumbnails option on Site Settings item for XM Cloud SXA site definition?
I can see following setting on site settings for XM Cloud SXA sites site definition item.
"Generate thumbnails"
Cannot find anything in the documentation also related to this.
| |
It seems related to encoding. Just try to add encoding parameter equals UTF8 like this while downloading file.
$content | Out-File -FilePath "D:\test.html" -Encoding UTF8
Check this article for further reading - https://stackoverflow.com/questions/12190078/stylesheet-taken-over-replaced-by-chinese-characters
| How to download a page with SXA theme using powershell
I'm working on a task, where I need to download a page as HTML. This page is from our website built on Sitecore 10.1.3.
I'm using powershell to achieve this. The page download's fine, but there are console errors for all the JS script files. All these are from Sitecore Media Library.
When I open the view source of the downloaded page and click on any JS reference, the JS file content loads fine.
But in browser console, it shows errors and some Chinese content. These errors are only for JS scripts but not for any CSS even though they are also rendered from sxa theme.
I have tested this with different websites
https://example-1-page-with-sxa-theme.com - Has issue
https://example-2-page-with-sxa-theme.com - Has issue
https://example-3-sitecore-page-with-no-sxa-theme.com - No issue
https://example-3-non-sitecore-page.com - No issue
Windows powershell script:
cls
$page = Invoke-WebRequest -Uri "https://example-1-page-with-sxa-theme.com"
$content = $page.Content
$content = $content.Replace('="/','="https://example-1-page-with-sxa-theme.com/')
$content | Out-File -FilePath "D:\test.html"
| |
In Sitecore, the UserManager class is part of the Sitecore.Security.Accounts namespace. To use it, you typically need to reference the Sitecore.Kernel assembly in your project. The DLL file you need is usually named Sitecore.Kernel.dll.
And if you are working on extending functionality make sure to add the Sitecore.Owin.Authentication DLL in your project.
As per your comments, make sure that you are referring to the following DLLs in your project to make the code working.
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
Make sure to check the specific version of Sitecore you're working with, as the DLL version might vary.
Ensure that the DLLs are included in your project references, and you should be able to use the UserManager class for managing users in Sitecore.
Hope this helps.
| What is the reference DLL need to be added for UserManager?
ApplicationUser BuildUser(UserManager<ApplicationUser> userManager
What is the reference DLL we need to add for this UserManager class?
| |
This may be a long shot, but please try checking the standard Sitecore config file \App_Config\Sitecore\Owin.Authentication.IdentityServer\Sitecore.Owin.Authentication.IdentityServer.config.
This config enables the identity provider and pipelines responsible for Identity Server integration. In version 9.3 this config is applicable to CM, CD and Standalone roles:
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
Starting from version 10 this has changed and now this config is only enabled for CM and Standalone instances:
<sitecore role:require="Standalone or ContentManagement">
So please try checking this file and if it's the problem, you will need to create a config patch enabling Identity Server integration for your CD role.
| Login redirecting to 401 only on CD Server after upgrade to XP 10.3
We have recently upgraded one of our Sitecore XP Instances from 9.3 to 10.3.
In our instance, we have one front end site, which has requireLogin="true" and loginPage="$(loginPath)oursite/SitecoreIdentityServer/IdS4-WsFederation" configured on the site node. This normally results in any visitors to the front end being redirected first to Identity Server, then to our on Premise ADFS.
This process worked fine pre upgrade (in XP 9.3). It also continues to work fine when visiting the front end on our CM instance post upgrade (in XP 10.3). However, now on our CD instance, when we try to access the front end, we are immediately redirected to a 401 page. Sequence below:
site-root/
site-root/identity/login/digitalportal/SitecoreIdentityServer/IdS4-WsFederation?returnUrl=%2f
site-root/identity/externallogin?authenticationType=SitecoreIdentityServer&ReturnUrl=%2fidentity%2fexternallogincallback%3fReturnUrl%3d%252f%26sc_site%3ddigitalportal%26authenticationSource%3dDefault&sc_site=digitalportal&idp=IdS4-WsFederation
The failure appears to be prior to any connection to identity server (no logs present their). Their are no exceptions showing in the sitecore logs either.
Troubleshooting
I have tried a variety of things trying to compare why the CM works and the CD doesnt (switching bin/app_config/web.config etc over CM instance).
I have found that if I update the CD instance to have key="role:define" value="ContentManagement" in the web.config (and copy over CM connection strings), the login works fine. If I switch back to 'ContentDelivery' if fails again.
So that one single update (all other config left exactly the same) is enough to reproduce the issue.
This would suggest to me that the issue is down to some role based config files. However we only have one custom config that is "CD only" which deals with private session. We have a larger number of "CM only" files, but these are stripped out during the deployment of the CD instance. So these can have no bearing (as shown above CM works ok without them).
There would obviously be a large number of OTB sitecore config files that are CD Only, but we have not has a problem in XP 9.3.
Other considerations
The upgrade to 10.3 led us to switch to using the Duende Identity server. We are using that plus a plugin originally based on this from George Chang to link through to On Prem ADFS. However, as I mention I dont believe it is getting as far as ID server.
When the CM successfully logs in, it follows the exact same sequence of redirects above. But then moves from (3) to (4)
mysite-root/connect/authorize?client_id=Sitecore&response_type=code%20id_token%20token&scope=openid%20sitecore.profile&state=OpenIdConnect.AuthenticationProperties%3DdYz2TBvb7nQDCicsKGtxp7jeGnKMlNPakSY0tUwH--6tSfSfr9slzjVb4MSycHMDUZkOjxwIz809gW4wb-Sm8sxfg8lkeDfjEsPodMlgL7RrRK38CWbjJOg9-ifQumQHhKgbFtRZEmRd0IL_mqwry0H3Fpm2V4QNdfvqXLaXOmyv0dozrtyOWbL9yIgsPiMjNAM-0DRDc9BMmuirdEfObfRqOKv02x0xVwQr51gYDMjd0DowrX_Hfrz9ya5QO2IVVv3Rk3HlfNDSCytiKw8E0A&response_mode=form_post&nonce=638386701886505118.MzEwOWNlOTUtNzRlOC00MjhlLThmODktODM1MTJiNzY2MGJmYTM0ODBlYjMtNWQ5Yy00ZmNlLWIxZWEtODJhYzMyYmQ5OGI2&acr_values=idp%3AIdS4-WsFederation&redirect_uri=https%3A%2F%2Fmysite%2Fidentity%2Fsignin&sc_account_prefix=azure%5C&x-client-SKU=ID_NET461&x-client-ver=5.3.0.0
Finally, whilst the resulting page after the failed login shows a HTTP ERROR 401. The corresponding network trace in the console shows HTTP_RESPONSE_CODE_FAILURE (please see attached image).
| |
They are defined in core database under
/sitecore/client/Applications/ContentTesting/Common/Layouts/Composite/Scheduling/PageSettings
Minimum durations are items in
/sitecore/client/Applications/ContentTesting/Common/Layouts/Composite/Scheduling/PageSettings/MinimumDurations
folder and maximum durations are items in /sitecore/client/Applications/ContentTesting/Common/Layouts/Composite/Scheduling/PageSettings/MaximumDurations
folder.
See the screenshot from core database:
Look like either you have some backend or javascript errors which prevents them from loading on your website or one removed the values from core database.
| Duration Test data source
I'm currently working on the content tests, and the moment to activate this feature, I discovered that the Objective window, inside the duration section, Sitecore never display any value.
Does anyone knows where I can configure this?
| |
This is because of the default way that XM Cloud deploys the serialization. The SCS files are used to generate an Item as Resources(IAR) file and that is layered into the XM Cloud instance.
Roles cannot be added via an IAR file.
To add the roles, you would need to use the scsModules post deploy action in the xmcloud.build.json file.
You need to create an SCS module that is used to serialize the roles, then in the xmcloud.build.json add a section to the post deploy actions:
"postActions": {
"actions": {
"scsModules": {
"modules": ["Module1","Module2"]
}
}
}
This uses the SCS sync action post deployment to deploy what is in the modules.
For the "modules" array, you have to provide "namespace" value mentioned on your .module.json configuration
Ref:
https://doc.sitecore.com/xmc/en/developers/xm-cloud/the-xm-cloud-build-configuration.html
| Sitecore Serilization Roles Doesn't Get Created on XM Cloud Environments
I have setup Sitecore Serialization configuraiton for roles and was successfully able to merge pull those from local instance into project files.
{
"$schema": "../.sitecore/schemas/ModuleFile.schema.json",
"namespace": "ContentSettings",
"items": {
...
},
"roles": [
{
"domain": "SXA",
"pattern": "Admin"
},
{
"domain": "SXA",
"pattern": "Author"
},
{
"domain": "SXA",
"pattern": "Designer"
},
{
"domain": "Client",
"pattern": "Site Collection *"
},
...
And those roles are serialized under /src/items/_roles folder.
But when we run the XM Cloud deployment, it doesn't copy those roles into our XM Cloud environment.
Is there anything extra needed to be done other than explained config configuration in xm cloud documentation ?
Any help would be highly appreciated.
| |
You can create a custom rendering variant for Search box to get rendered html for suggestions. By default it uses horizontal, you can create a new for example horizontal-absoluteurl.
Image: How you can check what html is rendered for the item via your rendering variant
Scriban have parameter to get url {{i_item.url }} see if that works, if not you will need to create custom scriban extension like {{i_item.url_absolute}}.
The custom scriban extension which will have your c# logic for getting absolute url for item by detecting its related site context (by matching path or any other logic you want).
You can refer this blog creating scriban extension: https://www.dotnet-ltd.com/blog/create-item-extension-with-scriban
<div class="field-title your-custom-rv-for-absolute-url"><a title="{{i_item.Title}}" href="{{i_item.url_absolute}}">{{ sc_field i_item "__Display Name" }}</a></div>
Note: I'm sharing the idea, but it hasn't been tested yet.
Hope this helpful!
| Sxa search box suggested result not found in multisite scenario
Context: I am using the sxa search box component in site A to search through the items of site B, which is a shared site.
The search itself it is working fine: when I click enter, it shows the results page of site B, as required. Also the search box drop-down is showing the right suggestions.
Issue: when clicking on a suggestion in the drop-down I get a 404, since the link of the suggestion does not contain the domain of the site B and the item is not found on site A.
Question: it is possible to add the domain to the link of the suggestion in order to manage this multisite scenario or is there another way of doing this?
I have tried to set the field Suggestions mode to Show search results as predictions but the required behaviour is to link directly to the item when clicking on the suggestion, not to go to the results page.
Thanks for any advise
| |
If you get the value of a rich text field like
item["richtext"]
you will receive raw value of the field, including internally formatted links like <a href="~/link.aspx?_id=67HTg5464321&amp;_z=z">here</a>
You need to add the following code to render value of the field:
Sitecore.Data.Items.Item item;
string fieldName;
var fieldRenderer = new Sitecore.Web.UI.WebControls.FieldRenderer();
fieldRenderer.Item = item;
fieldRenderer.FieldName = fieldName;
fieldRenderer.DisableWebEditing = true;
RenderFieldResult renderFieldResult = fieldRenderer.RenderField();
string richTextFieldValue = renderFieldResult.ToString();
| How can I return a RichText field via an API and render links correctly?
In my item I have a RichText field that I am returning the value via an api (API controller called from jQuery).
In the response, I am able to render the value.
But issue is that my RichText field value contains an item link like this: <a href="~/link.aspx?_id=67HTg5464321&amp;_z=z">here</a>
Do we have any option to render my RichText field using HTML.RAW in jQuery or any other option to do the same arrangement in controller before returning to jQuery response.
As I want my link item to converted before rendering to the friendly url (ex: https://domain/abc/dec).
| |
You can deploy NextJS to IIS
1- install URLRewrite and IISNode
2- add web.config
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="myapp">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
<iisnode node_env="production" nodeProcessCommandLine="&quot;C:\Program Files\nodejs\node.exe&quot;" interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;" />
</system.webServer>
<location path="" overrideMode="Deny">
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
</system.webServer>
</location>
<system.net>
<mailSettings>
<smtp from="">
<network defaultCredentials="false" host="" password="" port="25" userName="" />
</smtp>
</mailSettings>
</system.net>
</configuration>
3- add server.js
{ createServer } = require('http')
const { parse } = require('url')
const next = require('next')
const cors = require('cors');
require('dotenv').config();
const dev = process.env.NODE_ENV !== 'production'
const port = process.env.PORT || 3000;
const app = next({ dev })
const handle = app.getRequestHandler()
const corsOptions = {
origin: process.env.SITECORE_API_HOST,
};
app.prepare().then(() => {
createServer((req, res) => {
const parsedUrl = parse(req.url, true)
const { pathname, query } = parsedUrl
if (pathname === '/a') {
app.render(req, res, '/a', query)
} else if (pathname === '/b') {
app.render(req, res, '/b', query)
} else {
handle(req, res, parsedUrl)
}
}).listen(port, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})
| deploying next.js JSS app to sitecore
I have installed sitecore 10.0.3 on premise on dev server (remote desktop) and created next.js Jss app and connected the app with sitecore, now i have the app running and i can access the site from inside remote desktop, also i can access the sitecore CMS from out side the remote desktop but i can not access the site or experience editor for pages from out side the remote deskop.
how shall I deploy the app to make the site public from out side the remote desktop?
note : I am using next self rendering host loaclhost:3000
| |
I first thought this might be related to an old windows version I was running on. So I updated it. But that did not help. So,inspecting the docker image using
docker image inspect mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
revealed that my docker image was from 2022 and not the one from 12th december 2023
Seems this package cannot handle the .net 8 but only .net 6
So I manually pulled latest
docker image pull mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
after inspecting that version it looked like I have the new version.
I ran the up.ps1 script again and the problem was solved.
| Error when running .net 8 application with XM Cloud in local docker containers (XM Cloud Introduction) - Error NETSDK1045
I wanted to run the XM Cloud Introduction Repo in local docker containers.
Reproduction steps:
I cloned the main branch to my local
I ran the init script
I adjusted the .env file as I'm running on windows 10
I stopped IIS
I made sure docker is running for windows and not for Linux
I installed dotnet 8 to meet the head application requirements
I ran the up script
The following error occurs on step 15/20:
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Project\MvpSite\rendering\Mvp.Project.MvpSite.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Feature\Navigation\rendering\Mvp.Feature.Navigation.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Feature\BasicContent\rendering\MVP.Feature.BasicContent.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Feature\Social\rendering\Mvp.Feature.Social.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Foundation\Configuration\rendering\Mvp.Foundation.Configuration.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Feature\People\rendering\Mvp.Feature.People.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Feature\User\rendering\Mvp.Feature.User.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Foundation\DataFetching\rendering\Mvp.Foundation.DataFetching.Rendering.csproj]
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\build\src\Feature\Selections\rendering\Mvp.Feature.Selections.Rendering.csproj]
| |
With Next.js, you can use a tool like NextAuth.js to add authentication. NextAuth.js has providers for Azure Active Directory and Azure Active Directory B2C.
This would be enabled for your rendering host that is delivering your public website. Normally you should have a separate rendering host configured for editing. The authentication would then be disabled for editing which would enable Experience Editor to work correctly.
| How to authenticate users with on JSS application?
I am developing a JSS application (NextJS), and this app is only accessible to the internal staffs. And everyone must authenticate via Azure AD authentication to access the content. Typically for React/Angular, I would use MSAL library to authenticate.
But how do I do this with JSS app? I have successfully create one JSS app with MSAL library but I'm not able to edit the content from Experience Editor, it will keep on looping the authentication cycle. It is working when I access the rendering server directly.
| |
I assume that you are using the Sitecore CMS to build the PUBLIC facing website and in this case if anyone track the API key via browser then they will be able to see only known content which available publicly.
Other option is to add proxy and donβt expose actual url of call with api key
| Sitecore react jss form POST call expose sc_apikey on url
Does someone know why Sitecore expose your API_KEY with jss forms.
Create a simple form, open chrome dev tools (network tab) and click submit.
You will see something like this:
http://localhost:3000/api/jss/formbuilder?fxb.FormItemId=207146f1-9c73-408c-94f0-c6b3d9ae18fa&fxb.HtmlPrefix=fxb.36b3f201-5cee-4e7c-a812-6432e7ee4a88&sc_apikey={your_producion_key}&sc_itemid=65675a00-6f7a-4dc5-971e-943ca1aab455&sc_lang=en
where {your_producion_key} is the value store in your environments variables .env SITECORE_API_KEY=.
| |
If you have a closer look at the first line of your exception, you will see the answer:
Job started: Publish to 'web'|Items created: 0|Items deleted: 0|Items updated: 0|Items skipped: 2|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Could not find method: Process. Pipeline: /sitecore[database="SqlServer" sxaxm:require="sxaxconnect" patch:source="Test.Feature.AzureB2C.Serialization.config" unicorn:require="On" sxa:require="On" xmlns:patch="http://www.sitecore.net/xmlconfig/"]/pipelines[require="sxaxconnect" patch:source="Sitecore.LayoutService.Analytics.config"]/publish[help="Processors should derive from Sitecore.Publishing.Pipelines.Publish.PublishProcessor"]/processor[type="Test.Foundation.SitecoreExtensions.Overrides.CacheClearer, Test.Foundation.SitecoreExtensions" patch:source="Test.Foundation.SitecoreExtensions.CacheClear.config"]
See the sentence: publish Processors should derive from Sitecore.Publishing.Pipelines.Publish.PublishProcessor
Apparently your Test.Foundation.SitecoreExtensions.Overrides.CacheClearer does not inherit from the processor mentioned above. Make sure that it does inherit and your issue will be solved.
| System.InvalidOperationException: Could not find method: Process
I am getting an issues while publishing in the content editor.
Here is the full error if it will help
Job started: Publish to 'web'|Items created: 0|Items deleted: 0|Items updated: 0|Items skipped: 2|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Could not find method: Process. Pipeline: /sitecore[database="SqlServer" sxaxm:require="sxaxconnect" patch:source="Test.Feature.AzureB2C.Serialization.config" unicorn:require="On" sxa:require="On" xmlns:patch="http://www.sitecore.net/xmlconfig/"]/pipelines[require="sxaxconnect" patch:source="Sitecore.LayoutService.Analytics.config"]/publish[help="Processors should derive from Sitecore.Publishing.Pipelines.Publish.PublishProcessor"]/processor[type="Test.Foundation.SitecoreExtensions.Overrides.CacheClearer, Test.Foundation.SitecoreExtensions" patch:source="Test.Foundation.SitecoreExtensions.CacheClear.config"]
at Sitecore.Pipelines.CoreProcessor.GetMethodInfo(ProcessorObject obj, Object[] parameters)
at Sitecore.Pipelines.CoreProcessor.GetMethod(Object[] parameters)
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Publishing.Pipelines.Publish.PublishPipeline.Run(PublishContext context)
at Sitecore.Publishing.Publisher.PublishWithResult()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Jobs.DefaultJob.DoExecute()
at Sitecore.Abstractions.BaseJob.ThreadEntry(Object state)
| |
You can generate a JSS app `manifest manually, by running the JSS CLI command jss manifest.
The command jss manifest has options that enable modifying how the manifest generates, such as --includeContent to add content and routes data to the manifest. Run jss manifest --help to see all the options with descriptions.
Manifest does not include content, media, or dictionary items by default for safety, in case a content editor has changed the data. To include these items, run jss manifest --includeContent --includeDictionary to include everything.
Reference Links:
Generating a JSS app manifest file
Sitecore JavaScript Rendering SDK CLI Tools API reference
Hope it helps!
| Issue with running deploy command on Sitecore 10.2 JSS NextJS SXA
When I am initiating Sitecore JSS app with Nextjs,
npx create-sitecore-jss --templates nextjs,nextjs-sxa --appName sitecore-nextjs-app --hostName s102demo1cm.dev.local --fetchWith GraphQL
./Sitecore folder just has config folder, however, when I am trying to deploy items with following command:
jss deploy app -c -d
It is looking for pipelines folder and definitions folder and throwing errors:
JSS is creating a manifest for sitecore-jss-site to ./sitecore/manifest...
Enabling TypeScript transpilation for the manifest...
path or pattern './sitecore/pipelines/**/*.patch.js' did not match any files.
path or pattern './sitecore/pipelines/**/*.patch.ts' did not match any files.
Error generating manifest Error: ENOENT: no such file or directory, scandir
and
JSS is creating a manifest for sitecore-jss-site to ./sitecore/manifest...
Error generating manifest Error: Unable to load manifest require C:\kk\JSS\sitecore-jss-site\sitecore\definitions\config.js: Error: Cannot find module 'C:\kk\JSS\sitecore-jss-site\sitecore\definitions\config.js'
Require stack:
| |
I have further done the RCA and found that
when we are reading the index on the publishing target then it is reading the web index because in the site settings item, the Database field had the web DB selected, and due to the code sitecore_custom_{sitecore.context.database.name}_index it was coming as (sitecore_custom_web_index) and in the SOLR query it includes a predicate like fq=_indexname:(sitecore_custom_web_index).
I checked the returned data on the SOLR portal and then noticed that there is one field _indexname that includes the name of the index and this value is the name of the core mentioned for your index.
When we were reading the data with the web index on the new publishing target based cd I also noticed that in the project the web index was patched with the preview's index's core name and fq was sending the name of the web index as fq=_indexname:(sitecore_custom_web_index) but the web index is patched with preview's core, so the documents returned are having the _indexname field to be sitecore_custom_preview_index.
Therefore, while reading the web index, fq is passing the _indexname:(sitecore_custom_web_index) but the core is sitecore_custom_preview_index so documents returned as part of the query has the _indexname as sitecore_custom_preview_index so this is not matching as per the SOLR query generated, and the count is not same as should have been with web.
Now to resolve this we can modify the fq to send the _indexname to be the core name (sitecore_custom_preview_index) instead of _indexname (sitecore_custom_web_index). But, this is not possible as per https://stackoverflow.com/questions/38571353/clear-all-filterquery-in-sitecore-contentsearch-linq-query
So, we are now making the new preview's context change to preview, by selecting the preview DB in the site setting item' Database field so that _indexname can be passed as (sitecore_custom_preview_index) instead of _indexname (sitecore_custom_web_index)
| Solr not returning the result on new publishing target based CD
We are trying to get the data from one of the custom indexes and the data comes on CM and CD (web DB based) but we have created a new CD based on the new publishing target as a preview and there data doesn't come from the same index.
I checked the solr query in the logs, everywhere the query is the same on preview, cm, and cd (web). But when we load the data on preview cd then it does not return the data for the same query.
We have completely published the site on preview target.
We checked that data is also available in our custom index (obviously it should be there because it comes on cm and cd web but thought to check as I am stuck). So not sure why isn't it coming for the new preview.
Below is the query:
Solr Query - ?q=(((((((_path:(2ded2b03fsdfsg4cd2a46719ee) AND _template:(f7b5c470bsadfsg817bd9ac14af)) AND product_capabilities_sm:(0da4c6372aFSDF9ceddb77af3)) AND _latestversion:("True")) AND (has_country_restrictions_b:("False") OR country_availability_sm:(41239aSADFF38683cf83b7))) AND ((_path:("c83165SDFSDF9018d1b6cb4f") AND searchable_b:("True")) OR (_path:("fbdc2262a61a4SDFSD4a22d720") AND searchable_b:("True")) OR (_path:("00b9edfdFDSF7eb52c67") AND searchable_b:("True")) OR (_path:("a41bbe42fedd4asdsc6a10f") AND searchable_b:("True")) OR (_path:("685c0cdee82dsdsde6000f2a1fb") AND searchable_b:("True")) OR (_path:("c609e8ddsfsf9b1aee4f23") AND searchable_b:("True")) OR (_path:("a397f54d7sdsdcb067c016b7fe") AND searchable_b:("True")) OR (_path:("21b82c37d18b4sdsdbd7e43") AND searchable_b:("True")) OR (_path:("738c74fe88bc43sdsd3517281b6815") AND searchable_b:("True")) OR (_path:("ca63b9343sdsde71f4419") AND searchable_b:("True")) OR (_path:("27c198172dsdsd609df0d608b") AND searchable_b:("True")) OR (_path:("190fae814e7b445dbb4fe771a6946d16") AND searchable_b:("True")) OR (_path:("b240656ffaasdsdd5d3e684") AND searchable_b:("True")))) AND _language:("en")) AND _latestversion:("True")) AND _val_:__boost&start=0&rows=0&fq=(((-_readaccess:("U-_extranet\\Anonymous") *:*) AND ((-_readaccess:("R-_sitecore\\Coveo Configuration Admin") *:*) OR _readaccess:("U+_extranet\\Anonymous"))) AND (((-_readaccess:("R-_Everyone") *:*) AND (-_readaccess:("R-_extranet\\Everyone") *:*)) OR _readaccess:("R+_sitecore\\Coveo Configuration Admin") OR _readaccess:("U+_extranet\\Anonymous")))&fq=_indexname:(sitecore_taxes_web_index)&facet=true&facet.field=taxonomy_industry_name_list_sm&f.taxonomy_industry_name_list_sm.facet.mincount=1&facet.field=product_group_name_list_sm&f.product_group_name_list_sm.facet.mincount=1&facet.field=is_sustainable_application_b&f.is_sustainable_application_b.facet.mincount=1&facet.field=has_autonomy_b&f.has_autonomy_b.facet.mincount=1&wt=xml
Any suggestions for how to troubleshoot the query environment specific, to know why query behaves fine on cd web but not on the cd preview?
Update-1:
I checked that var i = searchContext.GetQueryable<CapabilityProductMappingSearchResultItem>(); line is not giving the result for the new CD but the same give to cd web. This code created the search context on the same index used for cd web and new publishing target based cd.
[PredefinedQuery("TemplateId", ComparisonType.Equal, "1245f04e-1758-4e94-a8eb-d90e433f750c", typeof(ID))]
public class CapabilityProductMappingSearchResultItem : SearchResultItem
{
[IndexField("capability_sm")]
public List<Guid> Capability { get; set; }
[IndexField("product_group_sm")]
public List<Guid> ProductGroup { get; set; }
[IndexField("products_sm")]
public List<Guid> Products { get; set; }
}
}
| |
Yes, there is an Integration Point for SPE to add custom scripts to the Insert Options menu.
You can read more about it in the official docs here.
| Adding New Custom Insert Options
Is there anyways that I can create a custom insert options like this for JSS Site (Properties Sites)? We want to integrate some Powershell script along the creation process such as display the form with couple fields and values and we can pull relevant data based on the information provided in that form (those fields can be optional). Thank you so much
| |
In order to pass a custom claim back to sitecore, you need to first make sure that it added to the sitecore.profile. You can patch this by adding a copy of IdentityServer.xml into the relevant sub folder in sitecoreruntime folder.
Example:
<IdentityResources>
<SitecoreIdentityResource>
<Name>sitecore.profile</Name>
<UserClaims>
<UserClaim1>name</UserClaim1>
<UserClaim2>email</UserClaim2>
<UserClaim3>role</UserClaim3>
<UserClaim4>http://www.sitecore.net/identity/claims/isAdmin</UserClaim4>
<UserClaim5>http://www.sitecore.net/identity/claims/originalIssuer</UserClaim5>
<UserClaim6>comment</UserClaim6>
<UserClaim7>user_login</UserClaim7>
</UserClaims>
<Required>true</Required>
</SitecoreIdentityResource>
</IdentityResources>
You then need to map the incoming claim from your identity provider to the claim in sitecore.profile. You do this by adding to the ClaimsTransformations block in the config file that defines your identity provider.
The example below is for AzureAD, but im guessing you would have something similar for Okta:
<Settings>
<Sitecore>
<ExternalIdentityProviders>
<IdentityProviders>
<AzureAd type="Sitecore.Plugin.IdentityProviders.IdentityProvider, Sitecore.Plugin.IdentityProviders">
<AuthenticationScheme>IdS4-AzureAd</AuthenticationScheme>
<DisplayName>Azure AD</DisplayName>
<Enabled>true</Enabled>
<ClientId>xxx</ClientId>
<TenantId>xxx</TenantId>
<MetadataAddress></MetadataAddress>
<ClaimsTransformations>
... other claims ...
<customClaimMapping type="Sitecore.Plugin.IdentityProviders.DefaultClaimsTransformation, Sitecore.Plugin.IdentityProviders">
<SourceClaims>
<Claim1 type="user_login" />
</SourceClaims>
<NewClaims>
<Claim1 type="user_login" />
</NewClaims>
</customClaimMapping>
... other claims ...
</ClaimsTransformations>
</AzureAd>
</IdentityProviders>
</ExternalIdentityProviders>
</Sitecore>
</Settings>
Once you have the above setup, I then recommend using a tool such as SI Snitch to confirm exactly what claims are reaching sitecore.
SI Snitch: https://github.com/KayeeNL/SI-Snitch
| How to get a custom claim data back from Sitecore Identity server
I am working with Sitecore 9.3 and SitecoreIdentity Server 7
I have created a custom claim in an Okta authorization server called user_login, this value appears when I preview the token in the tool found in Okta. I have also set this claim to be returned in the default scope as well as a custom scope.
However when I try and get the value to pass to sitecore I cannot see it appear in the list of claims.
What do I need to add to the identity server & sitecore config files to get this value to come through? The documentation does not really provide any clear ideas on how to achieve this...
| |
There is two Solutions for that
The First One is : option "Service email campaign" need to be checked on the "EMAIL EXPERIENCE MANAGER" - "Campaign creation" - "Delivery"Tab
The second Option is :
to set consent Field on your "send Email" action
| ERROR [Experience Forms]: The SMTP host was not specified
I am using Sitecore 10.3, try to use the send mail action in Sitecore forms, I have modified the SMTP Settings in Sitecore.EDS.Providers.CustomSMTP.Sync.config as the below
and in web config
<add key="eds:define" value="CustomSMTP" />
<add key="exmEnabled:define" value="yes" />
and I tested the connection and it is working
but when I submitted the form the mail not sent and I see error in logs "ERROR [Experience Forms]: The SMTP host was not specified."
but I can not figure out what is wrong or missing, any ideas??
| |
Short answer here is that you can't. That level of validation is not possible.
You should use an accessibility tool like Site Improve to check your pages and train the authors to build accessible content like that.
| Custom validation in Sitecore xmc
We have a requirement to resrict only one h1 header field in the page.so need to set up custom validation to allow only one such component having h1 header tag in it .
Can you help how can achieve custom validations where in we need to write above logic in sitecore xmc.
| |
In the end, I peeked into the Coveo.UI.Components.Models.IBaseComponentProperty and noticed Id was a string, and GlassMapper uses reflection to work out where to send the code for processing.
When I looked at the Glass.Mapper.Sc.DataMappers.SitecoreIdMapper I can see it trying to look for a type of ID or GUID. Since it was forced to be a string, it would throw the NotSupportedException. So the answer was to parse the ID type with custom code between these 2 libraries, and making sure it was a type of GUID. Unfortunately, the location of this custom code will differ per-project. So if you get this error, you'll need to work out where they talk and put that parse code in (new Guid(IBaseComponentProperty.Id);).
Hope that helps.
| "Coveo.UI.Components.Models.IBaseComponentProperties.Id" is not supported by "SitecoreIdMapper"
I'm new to Coveo and it's integration into Sitecore. We're currnently in the process of upgrading a 9.2 instance to 10.3. The search was working, but was missing a few things when we compared with the existing production we're wanting to replace. We suspect the client has not provided us the latest repo, as we're missing a lot of little code pieces.
In my travels of setting up my local I didn't have coveo configured at all, and the search component in the header looked like this.
After I installed the Coveo package. "Coveo for Sitecore 10.3 5.0.1277.4.zip" provided by our MVP. I then needed to authorize the account and create a trial enterprise subscription for my local instance.
All this worked fine, but when I navigated back to the website. The failing component now looked as it was entended, and showed a search icon with search input. As soon as I attempted to search, I got this error YSOD show up. I'm not sure where to start here.
\Views\Coveo Hive\Sections\Results Header Section.cshtml Line: 5
From my understanding this is an out-of-box component that comes from the package. So, I navigated to the Coveo Diagnostic page and it states the versions are compatible.
Does anyone know what would be causing this? Have you seen it before?
Where should I start looking?
Cheers
EDIT:
Here is the stacktrace of the error, and it seems to be related to GlassMapper.
Full Stack Trace:
[NotSupportedException: The type Coveo.UI.Components.Models.IBaseComponentProperties on Coveo.UI.Components.Models.IBaseComponentProperties.Id is not supported by SitecoreIdMapper]
Glass.Mapper.Sc.DataMappers.SitecoreIdMapper.Setup(DataMapperResolverArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\DataMappers\SitecoreIdMapper.cs:66
Glass.Mapper.Pipelines.DataMapperResolver.Tasks.DataMapperStandardResolverTask.Execute(DataMapperResolverArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\DataMapperResolver\Tasks\DataMapperStandardResolverTask.cs:30
Glass.Mapper.Pipelines.c__DisplayClass9_1.b__1(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:55
Glass.Mapper.Pipelines.AbstractPipelineTask`1.Next(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineTask.cs:33
Glass.Mapper.Pipelines.DataMapperResolver.Tasks.DataMapperAttributeResolverTask.Execute(DataMapperResolverArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\DataMapperResolver\Tasks\DataMapperAttributeResolverTask.cs:34
Glass.Mapper.Pipelines.c__DisplayClass9_0.b__0(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:65
Glass.Mapper.Pipelines.AbstractPipelineRunner`2.Run(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:77
Glass.Mapper.Context.ProcessProperties(IEnumerable`1 properties) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Context.cs:204
Glass.Mapper.Context.Load(IConfigurationLoader[] loaders) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Context.cs:176
Glass.Mapper.Pipelines.ConfigurationResolver.Tasks.OnDemandResolver.ConfigurationOnDemandResolverTask`1.Execute(ConfigurationResolverArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\ConfigurationResolver\Tasks\OnDemandResolver\ConfigurationOnDemandResolverTask.cs:26
Glass.Mapper.Pipelines.c__DisplayClass9_1.b__1(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:55
Glass.Mapper.Pipelines.AbstractPipelineTask`1.Next(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineTask.cs:33
Glass.Mapper.Pipelines.AbstractPipelineTask`1.Execute(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineTask.cs:27
Glass.Mapper.Pipelines.ConfigurationResolver.Tasks.StandardResolver.ConfigurationStandardResolverTask.Execute(ConfigurationResolverArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\ConfigurationResolver\StandardResolver\ConfigurationStandardResolverTask.cs:23
Glass.Mapper.Pipelines.c__DisplayClass9_1.b__1(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:55
Glass.Mapper.Pipelines.AbstractPipelineTask`1.Next(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineTask.cs:33
Glass.Mapper.Pipelines.AbstractPipelineTask`1.Execute(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineTask.cs:27
Glass.Mapper.Sc.Pipelines.ConfigurationResolver.TemplateInferredTypeTask.Execute(ConfigurationResolverArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\Pipelines\ConfigurationResolver\TemplateInferredTypeTask.cs:60
Glass.Mapper.Pipelines.c__DisplayClass9_1.b__1(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:55
Glass.Mapper.Pipelines.AbstractPipelineTask`1.Next(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineTask.cs:33
Glass.Mapper.Pipelines.AbstractPipelineTask`1.Execute(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineTask.cs:27
Glass.Mapper.Sc.Pipelines.ConfigurationResolver.SitecoreItemResolverTask.Execute(ConfigurationResolverArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\Pipelines\ConfigurationResolver\SitecoreItemResolverTask.cs:36
Glass.Mapper.Pipelines.c__DisplayClass9_0.b__0(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:65
Glass.Mapper.Pipelines.AbstractPipelineRunner`2.Run(T args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\AbstractPipelineRunner.cs:77
Glass.Mapper.AbstractService.RunConfigurationPipeline(AbstractTypeCreationContext abstractTypeCreationContext) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\AbstractService.cs:163
Glass.Mapper.AbstractService.InstantiateObject(AbstractTypeCreationContext abstractTypeCreationContext) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\AbstractService.cs:126
Glass.Mapper.Sc.SitecoreService.RunCreateType(Item item, GetOptions options, Dictionary`2 parameters) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\SitecoreService.cs:349
Glass.Mapper.Sc.SitecoreService.GetItem(GetItemOptions options) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\SitecoreService.cs:338
Glass.Mapper.Sc.Pipelines.Response.GetModelFromView.GetDataSourceItem(GetModelArgs args, Type modelType) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc.Mvc\Pipelines\Response\GetModelFromView.cs:174
Glass.Mapper.Sc.Pipelines.Response.GetModelFromView.Process(GetModelArgs args) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc.Mvc\Pipelines\Response\GetModelFromView.cs:82
(Object , Object ) +54
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +195
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args, Func`2 resultGetter) +161
Sitecore.Mvc.Presentation.Rendering.GetModel() +316
Sitecore.Mvc.Presentation.Rendering.get_Model() +31
Sitecore.Mvc.Extensions.ObjectExtensions.ValueOrDefault(T source, Func`2 resultGetter) +51
Sitecore.Mvc.Presentation.ViewRenderer.get_Model() +163
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +160
| |
Please try going to https://your-domain/sitecore/admin/PathAnalyzer.aspx
On this page you will find an option to perform Historic Map Rebuild.
This process will rebuild all currently deployed maps from historic
data in XDB. Depending on the number of interactions in XDB and the
processing power, this could be a very expensive operation. Important:
This feature is not expected to work in setups where processing server
is separated from the reporting server. Please refer to the Knowledge
Base for more details.
| 404 Error when building map
My path analyzer doesn't have any data. it is showing me like the image below. Could I know how to redeploy the map and rebuild the historical data?
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.