output
stringlengths 34
25.7k
| instruction
stringlengths 81
31k
| input
stringclasses 1
value |
---|---|---|
The standard url for the GraphQL playground that comes with Headless Services is: https://{CM Hostname}}/sitecore/api/graph/edge/ui
This endpoint is configured in the Sitecore.Services.GraphQL.EdgeContent.config file. Here's the snippet that applies to the playground:
<endpoints>
<edge url="/sitecore/api/graph/edge" type="Sitecore.Services.GraphQL.Hosting.GraphQLEndpoint, Sitecore.Services.GraphQL.NetFxHost" resolve="true">
<url>$(url)</url>
<enableSubscriptions>false</enableSubscriptions>
<!-- lock down the endpoint when deployed to content delivery -->
<graphiql role:require="ContentDelivery">false</graphiql>
<enableSchemaExport role:require="ContentDelivery">false</enableSchemaExport>
<enableStats role:require="ContentDelivery">false</enableStats>
<enableCacheStats role:require="ContentDelivery">false</enableCacheStats>
<disableIntrospection role:require="ContentDelivery">true</disableIntrospection>
<allowUnauthenticatedCorsPreflight role:require="ContentDelivery">false</allowUnauthenticatedCorsPreflight>
<schema hint="list:AddSchemaProvider">
<content ref="/sitecore/api/GraphQL/defaults/content/schemaProviders/edgeContent" param1="master" role:require="ContentManagement"/>
<content ref="/sitecore/api/GraphQL/defaults/content/schemaProviders/edgeContent" param1="web" role:require="ContentDelivery"/>
<content ref="/sitecore/api/GraphQL/defaults/content/schemaProviders/edgeContent" param1="context" role:require="Standalone"/>
</schema>
<!-- Determines the security of the service. Defaults are defined in Sitecore.Services.GraphQL.config -->
<security ref="/sitecore/api/GraphQL/defaults/security/publicService" />
<!-- Determines how performance is logged for the service. Defaults are defined in Sitecore.Services.GraphQL.config -->
<performance ref="/sitecore/api/GraphQL/defaults/performance/standard" />
<!--
Cache improves the query performance by caching parsed queries.
It is also possible to implement query whitelisting by implementing an authoritative query cache;
WhitelistingGraphQLQueryCache is an example of this, capturing queries to files in open mode and allowing only captured queries in whitelist mode.
-->
<cache type="Sitecore.Services.GraphQL.Hosting.QueryTransformation.Caching.GraphQLQueryCache, Sitecore.Services.GraphQL.NetFxHost">
<param desc="name">$(url)</param>
<param desc="maxSize">10MB</param>
</cache>
</edge>
</endpoints>
Do you see this configuration when you check your ShowConfig?
https://{CM Hostname}}/sitecore/admin/showconfig.aspx
If not, you will need to reinstall Headless Services.
| JSS 18 + GraphQL playground configuration issues - A public action method 'ui' was not found on controller
I am trying to use GraphQL playground in the test environment using Sitecore 10.1 with JSS 18. It works like a charm on local with the same configuration (both local & test have Standalone role), however when I try to run any query on test it does not work.
I try to access the endpoint url + /ui?sc_apikey={mykey} in the browser, the same URL is used in the playground URL. When I run a query
{
item(path: "/sitecore/templates") {
id
path
children {
name
}
template {
fields {
name
}
}
}
}
In the result window I see:
{
"error": "Unexpected token < in JSON at position 0"
}
and this happens for any query. When I checked the logs I see the below:
[HttpException]: A public action method 'ui' was not found on controller Sitecore.Services.GraphQL.Hosting.Mvc.GraphQLController.
at System.Web.Mvc.Controller.HandleUnknownAction(String actionName)
at System.Web.Mvc.Controller.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at Sitecore.Mvc.Routing.RouteHttpHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
So I am quite confused now because it says that the "UI" method does not exist, but with exactly the same query I am able to make things work on my local but not on test. Additionally I tried to remove the "/ui" from the playground URL and I'm just getting timeouts with no errors so it is quite hard to track.
What else should I verify to find the cause?
| |
You can refer to the official documentation for more detail but the long and short of it is you can create a safelist of controllers. You can use * however it is best practice to explicitly add your controllers to the list. If you have multiple controllers, you can add them to a new line and end the line with a ; character like so:
Sitecore.LayoutService.Mvc.Controllers.LayoutServiceController;
Sitecore.JavaScriptServices.Globalization.Controllers.DictionaryServiceController;
Sitecore.Services.GraphQL.Hosting.Mvc.GraphQLController;
GraphQL:/api/yourappname
| What are different values for Allowed Controllers in System Services API key for GraphQL?
I'm working on Sitecore 10.0 graphQL and trying to secure the endpoint by enabling PublicService using Authentication and Sc_api key. While applying security hardening I came across allowed controllers in system-> services-> api key. What is the purpose of Allowed Controllers and what is a best practice for graphQL to have this value. Is it fine to keep All (*) or we need specific controller to be added here as shown in below screenshot.
| |
If you are using Sitecore 9.1+ with SPE 6.3, there's a config file named: SPE.IdentityServer.config.disabled that needs to be enabled when using Identity Server.
Related (almost duplicate) questions:
Issue elevating SPE Console in 9.1 Azure PaaS
Unable to export query result to a file from Sitecore Powershell scirpt with Out-Download command
| SPE reports - CSV download doesn't work
We have built a powershell report which is working great. However none of the download buttons work. There is no error in browser nor sitecore logs. it just doesn't download the file. I've tried in Chrome and Edge but no lock.
I've recorded a video as reference.
https://www.screencast.com/t/T4zc0IbrKyrQ
| |
The logs show the following issue
[2022-06-04T14:15:23.127079600Z][com.docker.proxy.exe][E] cannot rewrite volumes: &errors.errorString{s:"mount denied:\nthe source path \"\\\\Projects\\\\MVP-Site\\\\docker\\\\deploy\\\\mvp-rendering:C:\\\\deploy:rw\"\ntoo many colons"}
That means the volume syntax in docker-compose file contains extra colons, I guess this one
deploy:rw
Check it out in the following docker-compose.override.yml file:
| Sitecore MVP-Site Docker Error
I am following the readme for the MVP-Site: https://github.com/Sitecore/MVP-Site
I am getting the default site coming up and the cm site at https://cm.sc-mvp.localhost/sitecore/ but the https://mvp.sc-mvp.localhost/ site gives a 404, the mvp-rendering docker image is showing "exited (1)" in Docker Desktop and the error with "docker logs -f mvp-rendering" is showing:
[2022-06-04T14:15:23.125031100Z][GoBackendProcess ][Info ] Failed to fire hook: close C:\Users\dev1\AppData\Local\Docker\log\host\com.docker.backend.exe.log: file already closed
[2022-06-04T14:15:23.124357300Z][com.docker.backend.exe][I] (edf8cafe) f6713b24-BackendAPI S<-C DockerDesktopElectron POST /usage
[2022-06-04T14:15:23.124357300Z][com.docker.proxy.exe][I] proxy >> GET /containers/fb3dcbb00285633536cdd0c6b6b6ca06ac71f39966c8068b2ef3a25ed879fc7c/json
[2022-06-04T14:15:23.126916200Z][GoBackendProcess ][Info ] Failed to fire hook: close C:\Users\dev1\AppData\Local\Docker\log\host\com.docker.backend.exe.log: file already closed
[2022-06-04T14:15:23.125031100Z][com.docker.backend.exe][I] (edf8cafe) f6713b24-BackendAPI S<-C DockerDesktopElectron bind: {"command":"containerStartClicked","count":1}
[2022-06-04T14:15:23.128042500Z][GoBackendProcess ][Info ] Failed to fire hook: close C:\Users\dev1\AppData\Local\Docker\log\host\com.docker.backend.exe.log: file already closed
[2022-06-04T14:15:23.126057700Z][com.docker.backend.exe][I] (edf8cafe) f6713b24-BackendAPI S->C DockerDesktopElectron POST /usage (1.7004ms): OK
[2022-06-04T14:15:23.127079600Z][com.docker.proxy.exe][E] cannot rewrite volumes: &errors.errorString{s:"mount denied:\nthe source path \"\\\\Projects\\\\MVP-Site\\\\docker\\\\deploy\\\\mvp-rendering:C:\\\\deploy:rw\"\ntoo many colons"}
[2022-06-04T14:15:23.129651500Z][ApiProxy ][Info ] [common/pkg/proxy.(*containerInspectRewriter).ResponseRewrite(0xc0003380e0?, 0xc8?, 0xd639dd?, {0xe88070?, 0xc0000c0b80})
[2022-06-04T14:15:23.129701200Z][ApiProxy ][Info ] [ common/pkg/proxy/containerinspect.go:59 +0x2cd
Thoughs on what to try or debug next? I have been trying to get this solution up for a few days now.
Thanks,
~james
| |
I think with the latest version of JSS, you need to use this command.
npx create-sitecore-jss
This command scaffolds a JSS application based on the latest version of JSS templates
Follow this article for more details.
https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/create-a-jss-project-for-the-latest-versions-of-jss-and-sitecore.html
To create an application based on an older version of JSS and Sitecore, you need to use this.
jss create my-jss-app react --branch release/<version>
Follow this article for more details.
https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/create-a-jss-app-for-an-older-version-of-sitecore.html
| jss create is not supported from JSS CLI version 20.0.0
I am trying to create an application for sitecore 10 JSS with react. But I am getting the error
jss create is not supported from JSS CLI version 20.0.0
can you please suggest.
| |
You should not use Sitecore.Context.Database in any backend job. It may be null there, or sometimes core, or sometimes master if you start some job manually.
You should use your item.Database property instead, e.g.:
public class CustomPublishProcessor : PublishItemProcessor
{
public override void Process(PublishItemContext context)
{
try
{
Item sourceItem = context.PublishHelper.GetSourceItem(context.ItemId);
var database = sourceItem.Database;
| sitecore.context.database.getitem returns null during publish pipeline
Created a custom processor to execute translation during publish process:
<processor type="Sitecore.Publishing.Pipelines.PublishItem.CheckSecurity, Sitecore.Kernel"
<processor type="Feature.Translation.Commands.TranslateOnPublish,Banner.Feature.Translation"
<processor type="Sitecore.Publishing.Pipelines.PublishItem.DetermineAction, Sitecore.Kernel"
while working on the class which is inheriting PublishItemProcessor is returning the value of
Sitecore.Context.Database null.
| |
You can use Sitecore queries to do this in the same way that SXA does, albeit with slightly more complex queries as you don't have the SXA tokens to use. Here is something to start you off:
query:./*[@@name='Datasources']/*[@@templatename='Banners Folder Template']|query:./ancestor-or-self::*[@@templatename='Your Site Root Template']/*[@@name='Datasources']/*[@@templatename='Banners Folder Template']
Note the | separating the 2 queries, you can add more if you need too. That would give you the 2 matching folders for your datasource as long as those folders exist.
You would add this to the Datasource Location field on the rendering item.
| How to write query for multiple Datasource locations
The content tree is like this
sitecore
|_ content
|_ Home
|_ Datasources
|_ Banners
|_ About
|_ Datasources
|_ Banners
|_ Datasources
|_ Banners
Home & About are pages.
All Datasources are folders of the Datasources Folder template.
All Banners are folders of the Banners Folder template.
I would like to set the datasource location for the Banner rendering, which should work as follows.
For Home page, when user clicks on Browse to choose a Banner datasource, then only these locations should be displayed.
sitecore
|_ content
|_ Home
|_ Datasources
|_ Banners
|_ Datasources
|_ Banners
And for About page, when user clicks Browse to choose a Banner datasource, only these locations should be displayed.
sitecore
|_ content
|_ About
|_ Datasources
|_ Banners
|_ Datasources
|_ Banners
Meaning, only the 'global' Banners folder and the respective page's Banners folder should be displayed.
Is it possible. If yes, could you please share the query.
| |
Please follow the below steps:
Go to the certificates -> personal certificates
Right-click on the identity server certificate
Click on All Tasks -> Manage Private Keys
Check if the identity app pool has permission on the identity certificate or not, it must have permission.
| Sitecore CM login not redirecting to identity server
I have installed Sitecore 10.2 XM in my local machine. It's installed 3 sites (CM, CD and IdentityServer).
When I access the IdentityServer URL https://test.identityserver.localhost/ it works fine. I am able to login and logout without any issues.
When I access the CM URL https://test.cm.localhost/sitecore/login I am expecting this should redirect me to IdentityServer site and after successful login redirect me to CM site. But this is not happening and when I access the CM URL https://test.cm.localhost/sitecore/login it is going to https://test.cm.localhost/sitecore/login?fbc=1 I am able to login successful though. But I expect it should go to IdentityServer site when I login/logout.
In the file, C:\inetpub\wwwroot\IDS\test.cm.localhost\App_Config\Sitecore\Owin.Authentication.IdentityServer\Sitecore.Owin.Authentication.IdentityServer.config, I have the following setting:
<sc.variable name="identityServerAuthority" value="https://test.identityserver.localhost" />
Below is my IdentityServer config file C:\inetpub\wwwroot\IDS\test.identityserver.localhost\Config\production\Sitecore.IdentityServer.Host.xml
<?xml version="1.0" encoding="utf-8" ?>
<Settings>
<Sitecore>
<IdentityServer>
<CertificateThumbprint>8C0635270629989F235AD625692FC9220F0C1400</CertificateThumbprint>
<CertificateStoreLocation>LocalMachine</CertificateStoreLocation>
<CertificateStoreName>My</CertificateStoreName>
<SitecoreMembershipOptions>
<ConnectionString>Data Source=XXXXXX;Initial Catalog=Test_Core;User ID=securityuser;Password=ZPOgVcB1jMWadVFP0R6K</ConnectionString>
</SitecoreMembershipOptions>
<AccountOptions>
<PasswordRecoveryUrl>https://test.cm.localhost/sitecore/login?rc=1</PasswordRecoveryUrl>
</AccountOptions>
<Clients>
<DefaultClient>
<AllowedCorsOrigins>
<AllowedCorsOriginsGroup1>https://test.cm.localhost</AllowedCorsOriginsGroup1>
</AllowedCorsOrigins>
</DefaultClient>
<PasswordClient>
<ClientSecrets>
<ClientSecret1>IdentityServerClientSecret</ClientSecret1>
</ClientSecrets>
</PasswordClient>
</Clients>
</IdentityServer>
I have the below entry in my CM site connectionstrings.config file as well:
<add name="sitecoreidentity.secret" connectionString="IdentityServerClientSecret" />
| |
There is no built in tool with Sitecore that allows you to easily inspect the cache keys that have been constructed in the HTML cache. To do this you need to write your own inspection page or tool. Alternatively you could install Sitecore Rocks – the tool that integrates with Visual Studio which allows you to view the cache keys. To do this Manage your site from within the Visual Studio Sitecore Explorer and select the caches tab. Scroll down to “yoursitename[html]” and double click it. The Explore cache window should appear and you should then be able to see the cache keys currently in the cache e.g.:
You can also check cache details on the below paths :
https://hostname/sitecore/admin/stats.aspx
https://hostname/sitecore/admin/cache.aspx
| How to check cache key in Sitecore SXA?
I am working on Sitecore SXA and we are planning to implement cache. I have enabled it on Site level and added cache on rendering level for all the sites inside tenant. Now my question is how can we check cache is enabled at browser level or check cache key somewhere in Sitecore (log file). How can we check its key (cache key)? Just want to check cache is working fine at our site?
| |
We recently did a similar upgrade and had the same questions (as the log files identified close to 200 modified items).
The reason it is important is to ensure that your Sitecore solution is using the most up to date versions of those items.
The log files give an indication of what field on the item has been altered, so based on that information you could decide its not worth making the change. However, you risk missing some important change between old and new. The safest bet is to delete the item (and corresponding fields values) from the SQL DB and then reapplying through Sitecore.
One thing I would stress though, is that it is very important that you apply these changes to all publishing targets after you do the master DB (as mentioned in the upgrade docs).
Failure to do this can lead to content being deleted on publishing targets.
| Clean up DB for Sitecore upgrade - IAR items
We are doing Sitecore upgrade from 9.2 to 10.2. We are using XP topology hosted in On Premises. In 10.x. Sitecore introduced IAR (Items As Resource) to manage Sitecore default items such as templates, renderings, layout etc., While doing clean up DB using Sitecore Update App, we found that there 35+ items are registered in log file which we have to do clean up. So we are deleting those items from DB and apply the customization manually. I have below questions:
Is this clean up activity mandatory? What would be impact if we are
not doing?
Is there any quicker solution available for applying customization
for those default items?
| |
You would need to modify the SxaLayout.cshtml file to do this. If you look at the file, at the top it gets all the asset links:
@{
AssetLinks assetLinks = AssetLinksGenerator.GenerateLinks(new ThemesProvider());
}
Once it has those, it renders the styles in the head and the scripts just before the body close:
@foreach (string script in assetLinks.Scripts)
{
@Html.Raw(script)
}
</body>
You would first need to move that to the head in the layout. To add the defer attribute is going to require you to modify the AssetLinksGenerator.GenerateLinks method. If you decompile that method and follow it through, you will see that the <script> tags are hard coded. For the base themes, the method is called GetLinks - you can inherit and override that method tho.
These are the decompiled lines:
foreach (string str in result1.Styles.Select<string, string>((Func<string, string>) (link => "<link href=\"" + link + "\" rel=\"stylesheet\" />")))
result.Styles.Add(str);
foreach (string str in result1.Scripts.Select<string, string>((Func<string, string>) (link => "<script src=\"" + link + "\"></script>")))
result.Scripts.Add(str);
Modify that and add your defer attribute in.
| Sitecore SXA Base Theme script issue
I would like to ask could we move these scripts from body tag to head tag? Because i want to add the defer attribute for these scripts.
| |
Ultimately, it likely comes down to "why do you want to share your apps?" and then making a decision on what to share and what to isolate based on your priorities.
I echo @Dean OBrien on this one. You are sharing a SOLR server, but not sharing the actual indexes (you could share indexes, but that's not likely to work well!). You can do something similar with xConnect and processing web apps. You cannot share the database entries, indexes, apps, but you could deploy them to a combined server on a VM instead of using isolated web apps if you are looking to reduce hosting costs. If these are not meant to be performant environments, you may not notice the issue of running multiple environments app installs on a single VM.
An example could be like the following (simplified, there are other apps and services and databases too that you need, and this shows only 3):
xConnect VM
xConnect1
Processing1
xConnect2
Processing2
xConnect3
Processing3
SQL Server instance
xDB ShardManager1
xDB Shard1_1
xDB Shard1_2
xDB ShardManager2
xDB Shard2_1
xDB Shard2_2
xDB ShardManager3
xDB Shard3_1
xDB Shard3_2
This would allow you to share some resources and move towards an IaaS approach, although it will impact your performance and that shared SQL Server is going to start growing fast with all those xConnects writing to it.
This also breaks isolation of your environments meaning that your infrastructure-as-code approach is harder to achieve because you now have shared pieces that work across multiple environments. It would be harder to tear down just environment 3 than before when they are fully isolated apps.
| Non prod environments can share Common Service such as Xconnect and Processing
We have a 10 non production System Integration test environments. Right now we have common shared Solr server. Likewise Is it possible to have shared Xconnect and Processing Webapps for multiple non production CD and CMS webapps?
| |
If you want to create a controller rendering then there is an option to clone an existing component in Sitecore SXA. Follow this article to know how to clone a component in SXA.
https://sbhatiablogs.wordpress.com/2020/10/01/how-to-customized-components-in-sxa-by-cloning/
And to know more about creating a controller rendering in SXA, you need to follow this article shared by Sitecore.
https://doc.sitecore.com/xp/en/developers/sxa/17/sitecore-experience-accelerator/walkthrough--building-a-simple-rendering.html
Also if you want to check the code of an existing OOTB Sitecore controller then you need to go to a particular component and you will find the controller class and assembly in the controller field like this.
In this example the controller is Sitecore.XA.Feature.Composites.Controllers.AccordionController and you can find this in the Sitecore.XA.Feature.Composites DLL. So you need to use some third-party tools to extract this DLL and you will be able to find the code.
Then if you want to extend this code, you can copy the same logic in your controller class and extend it as per your needs.
Then in the above image in the Controller field, you need to pass your class and assembly name and then this will work with your logic.
Hope this is enough information for you to start.
| Where to find the Controller Folder(Source File)
I am a beginner in programming and Sitecore. And I would like to create a Controller using C# to handle some business logic. But I cannot find any backend source files of Sitecore. Could someone tell me where I can find those source file and edit it? Because I saw there are plenty of people who can write custom backend code for their Site.
Can upload my root folder if needed.
| |
I have raised a support ticket to the Sitecore for the above issue and they suggested me the two approaches:
Sitecore Response:
First of all, let me comment on the approaches you have already tried:
Disabled the boostingManager in Sitecore.ContentSearch.config file.
The disabled attribute is ignored and has no effect on the behavior.
Removed the StaticItemBoostResolver processor in Sitecore.ContentSearch.config file.
This was a step in the right direction.
It means Sitecore will now ignore the value of the Boost field ('{93D1B217-B8F4-462E-BABF-68298C9CE667}') of the item.
Removed all the location included in includedLocations in Sitecore.ContentSearch.config file.
If no location is specified then all locations are scanned.
To achieve the desired behavior comment out all of the processors in the <indexing.resolveItemBoost> pipeline and rebuild the search indexes.
Alternatively, restore the original state of the pipeline.
Clear the value of the Boost field ('{93D1B217-B8F4-462E-BABF-68298C9CE667}') for every item.
Remove any boosting rules under
/sitecore/system/Settings/Rules/Indexing and Search/Item Rules
/sitecore/system/Settings/Rules/Indexing and Search/Global Rules
Rebuild the search indexes.
The latter approach is recommended as it does not require changing the behavior of the product.
| SOLR Search result order is different due to the query _val_:__boost function
After upgrading the project to Sitecore10.2 SOLR search result is different in order due to the query _val_:__boost function.
I have investigated the issue and found out that in Sitecore 9.0.2 our SOLR search query was:
..........AND (-_template:("083a4d2a38694013a9e2d18c05da70ae") *:*))
and in Sitecore 10.2 SOLR search query is:
..........AND (-_template:("083a4d2a38694013a9e2d18c05da70ae") *:*)) AND _val_:__boost
There is one more extra condition at last in the query i.e. AND _val_:__boost. I have gone through the Sitecore documents on Search result boosting and found that
In Sitecore XP 10.0.0 or later, item-level boosting relies on index-time scoring factors that are indexed in the __boost field and combined with the query score using the query _val_:__boost function.
I have also tried the below approach one by one but did not get any success:
Disabled the boostingManager in Sitecore.ContentSearch.config file.
Removed the StaticItemBoostResolver processor in Sitecore.ContentSearch.config file.
Removed all the locations included in includedLocations in Sitecore.ContentSearch.config file.
_val_:__boost function is affecting our search result order and I want to remove the function from our search query.
| |
You can set different types of targets on an anchor tag. Here is this list.
So if you select custom, then you can specify these targets in the custom textbox (that enables once you select custom) and it will appear in the _target attribute of anchor.
Read more here
https://www.w3schools.com/tags/att_a_target.asp
Hope this will help.
| Custom link target in sxa
I was trying to insert an external link . In link target there was an option in target is custom.
What does it mean?
| |
It seems that this is a very misleading error message. I decompiled and looked at the code that returns this message and I can't see it every fetching it from the environment variables.
The ExperienceEditorMiddleware injects an IOptions<ExperienceEditorOptions>, which I suppose could be added through an environment variable, but I never got it to work.
Instead I just manually configured the ExperienceEditorOptions in my ConfigureServices() and Experience Editor started working and I never saw the error message again:
public void ConfigureServices(IServiceCollection services)
{
services.AddSitecoreRenderingEngine()
.WithExperienceEditor(opt =>
{
opt.JssEditingSecret = "YourSecretHere";
});
}
You should never hardcode the secret like I've done here, of course. I actually ended up putting it into appsettings.json which is bound to a data model, and I use the information from the data model instead of the hardcoded value.
| Headless jss-render endpoint failing. Missing environment variable
Whenever I try to use Experience Editor towards my headless (dotnet) rendering host I get the following error:
Connection to your rendering host failed with a Not Found error. Ensure the POST endpoint at URL http://localhost:5268/jss-render has been enabled.
And this error in my Rendering Host console output:
> [15:06:53 ERR] The JSS_EDITING_SECRET environment variable is missing or invalid.
> [15:06:53 INF] HTTP POST /jss-render responded 400 in 7.7200 ms
I have the following setting in my Sitecore installation:
<setting name="JavaScriptServices.ViewEngine.Http.JssEditingSecret" value="SitecoreJssEditingSuperSecretValue" patch:source="Sitecore.JavaScriptServices.ViewEngine.Http.config"/>
and I have the following in my launchsettings.json:
{
"profiles": {
"My.Project.Rendering": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7268;http://localhost:5268",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"JSS_EDITING_SECRET": "SitecoreJssEditingSuperSecretValue",
"SITECORE_JSS_EDITING_SECRET": "SitecoreJssEditingSuperSecretValue"
}
}
}
}
Which should ensure that the environment variable is set, and both Sitecore and my rendering host should be set up to use "SitecoreJssEditingSuperSecretValue" as the key, yet the error still appears in the rendering host and Experience Editor still fails.
This is a standalone 10.2 XP0 installation without Docker.
What am I missing here?
| |
You need to set the rule for both entity definitions M.Asset and M.File, and then you have to select ReadAnnotations and CreateAnnotations permissions.
Your portal pages rule is fine, but remove the rules you did for M.Annotations, M.File, M.Asset and use the the rule I detailed. That should give your user annotation read/write permission.
| What Security Policies are necessary to enable the Annotate function?
I am unable to get the Annotate function working for a non-SuperUser.
My test user sees this (note missing Annotation option):
And has a group with these policies:
Things I've tried:
Enabling all rights on M.Asset.
Enabling full CRUD on M.File and M.Annotation.
Giving Read to all Annotate related portal pages.
Adding ANY access for all the "builtin" groups.
Cleared all caches.
Restarted the sandbox.
Version 3.4.6.
| |
If you look at your CM, you should see its role is set to "ContentManagement,Indexing". The Indexing role is the one that's handling the processing. You can read more about this configuration in the Sitecore docs: https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/enable-the-indexing-sub-role.html
I'm not sure if there's an additional step needed to trigger this indexing-only server, there might be. I'd suggest pinging Sitecore support if you don't get a better answer here.
| Sitecore 10 Solr Indexing only on processing server
Our Sitecore CM has a huge amount of content data and whenever running the index from the control panel it's become a huge load on our Sitecore instance and took a couple of hours.
So, we want to shift the master and web index from the Sitecore CM server to the processing server.
Please guide me is it possible whenever we trigger indexing for master/web then it should run over the processing server instead of the CM server so that the IIS Sitecore CM website can be free from a huge load of indexing?
| |
Very short answer, but with a Rich Text field this will not work (you can tweak the RTE to allow all kinds of tags but you really don't want to do that for scripts).
Try using a Multiline Text field. That should do it.
| Make Javascript editable in Sitecore SXA CMS?
I am using Rich Text Editor for the template field for script content, I need to make the entire script editable in Sitecore SXA 10. The RTE removes the script content.
The script content is as follows:
<script type="text/javascript" src="https://cdn.cookielaw.org/consent/{{ID}}-test/OtAutoBlock.js" >
</script>
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="{{ID}}-test" >
</script>
<script type="text/javascript">
function OptanonWrapper() { }
</script>
Are there any alternative ways in Sitecore to consider the script content the way it is?
| |
Post some investigation noticed that sitecore adds this rev=-1 whenever there is no language version for the media item in the current language scope !!
Although it was a recommended practice for performance to have media items in default languages as the Mediafield blob is Shared anyway which was enough to fetch un-revisioned assets ,
However the issue lies in the behavior of Build method Sitecore.Links.UrlBuilders.MediaUrlBuilder code in fetching the revision.
Reason: As the revision field being Unshared and when the media item does not exists for a default language item the Build method tries to resolve the Revision field on this language context and is not found hence defaults to -1.
Solution: I have a workaround to fetch the revision from fallback language which is en in our case whenever there is no relevant media item in default language , this shall ensure to always have the revision which helps CDN caches to work as expected with UniqueUrls whenever assets being modified on same media item.
Patch : <links> <mediaUrlBuilder> with the following override:
public override string Build(MediaItem item, MediaUrlBuilderOptions options)
{
var mediaUrl = base.Build(item, options);
if(item == null || item.InnerItem == null)
{
return mediaUrl;
}
if(mediaUrl.IndexOf("rev=-1", StringComparison.OrdinalIgnoreCase) > -1)
{
var defaultEnItem = Sitecore.Context.Database.GetItem(item.InnerItem.ID, Sitecore.Globalization.Language.Parse("en"));
var fallbackItemRevision = defaultEnItem?.Fields[new ID(_revision)]?.ToString();
if (!string.IsNullOrWhiteSpace(fallbackItemRevision)) {
return Guid.TryParse(fallbackItemRevision, out Guid result) ? mediaUrl.Replace("rev=-1", $"rev={result.ToString("N")}") : mediaUrl;
}
}
return mediaUrl;
}
Note: I an not sure if this is fixed in latest versions of Sitecore.
| Sitecore media with AlwaysAppendVersion set to true adds the revision to -1 for non default language versions
Environment: Sc 10, SXA 10x, Azure PaaS
Sitecore adds query string param rev=-1 to the media url whenever there is no language version available for asset other than default Language.
ex: /-/media/project/site/home/hero-banner.jpg?rev=-1
This happens with Multilanguage environment, We have media library setup with assets based on Unrevisioned Image Template !!
Although our default site language is en-us we prefer to manage all assets in the fallback language en (this helps to have single asset across langs)
This works as expected with asset rendering as the media blob is shared field which means the actual asset is shared across languages, however due to rev being added as -1 have been causing issues with caching whenever the asset is modified (detaching and attaching a new asset causes the rev not to be updated and url is not unique anymore).
Could someone help let me know if this is expected behavior to have media assets in all language versions for all the available site languages ? (despite the Media field is Shared)
| |
Start with checking App_Config\Modules\SXA config files.
You will easily find Sitecore.XA.Feature.Redirects.config in Feature folder there.
In that file you can see
<processor patch:after="*[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']" type="Sitecore.XA.Feature.Redirects.Pipelines.HttpRequest.RedirectMapResolver, Sitecore.XA.Feature.Redirects" resolve="true">
<CacheExpiration>720</CacheExpiration>
</processor>
It means you have to check Sitecore.XA.Feature.Redirects.dll and RedirectMapResolver class to find out how redirect maps works in SXA.
| Redirect map work
How to check redirect map programming functionality in Sitecore SXA?
Here, I am taking about Sitecore .dll which are using for redirect map. Is there any path in Content editor to check the assembly path of it?
| |
You would need to build a custom Sitecore image for the Identity Server: https://doc.sitecore.com/xp/en/developers/102/developer-tools/building-custom-sitecore-images.html
You need a project with your custom files that you can build in your solution Dockerfile (with msbuild) just like the platform build which is probably already there.
Then you need to change the Dockerfile for the ID to copy the files from that artifact (and change the docker-compose-override to pass the necessary arguments). This ID Dockerfile could be something like:
# escape=`
ARG PARENT_IMAGE
ARG SOLUTION_IMAGE
FROM ${SOLUTION_IMAGE} as solution
FROM ${PARENT_IMAGE}
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
WORKDIR C:\Identity
# Copy identity artifacts
COPY --from=solution /artifacts/identity/ ./
ENTRYPOINT ["dotnet", "Sitecore.IdentityServer.Host.dll"]
| How can I deploy custom config files to an Identity Server container?
We'd like to enable the Sitecore Federated Authentication on Sitecore 10.2 with containers. I've updated the ClientId, TenantId, claim transfermations, etc... in different xml files. But I don't know how to deploy those files into the Identity Server container.
| |
Fast:// Query is not supported in Sitecore 10.1 and onwards.
Sources: http://www.stockpick.nl/english/the-end-of-sitecore-fast-query/
Official Source:
https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/101/Sitecore%20Experience%20Platform%20101/Release%20Notes#Highlights
Sitecore Experience Platform 10.1.0 includes:
You can now use the content hierarchy to assign a behavior profile to multiple items.
- You can now use content tags to assign a behavior profile to multiple items.
The Collection database now supports scalable reads.
You can now use the new Data Purge CLI tool to remove unwanted contact data from the Experience Database.
Sitecore Fast Query has been deprecated.
[...] and more
| Sitecore 10.1 Fast Query CompositeDataProvider System.NullReferenceException
I have faced an issue with fast queries in Sitecore 10.1.
When I execute SelectSingleItem fast query:
Database.GetDatabase("master").SelectSingleItem($"fast:/sitecore/system/Modules//*[@@templateid='{Constants.Templates.DemoModule}']");
I get the following error:
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Kernel
at Sitecore.Data.DataProviders.CompositeDataProvider.TransformQuery(String query, Boolean& allowMerging, String& filterPathId)
at Sitecore.Data.DataProviders.CompositeDataProvider.SelectIDsInternalFast(String query, Boolean singleItemQuery, CallContext context)
at Sitecore.Data.DataProviders.CompositeDataProvider.SelectSingleID(String query, CallContext context)
at Sitecore.Data.DataProviders.DataProvider.SelectSingleID(String query, CallContext context, DataProviderCollection providers)
at Sitecore.Data.DataManager.SelectSingleItem(String query, Boolean& processed)
at Sitecore.Data.DefaultDatabase.SelectSingleItem(String query)
It works fine if I remove "fast:" prefix in query. Fast queries also work fine in previous Sitecore versions (tested in all 9.0-10.0).
The problem is that it is a bad idea to change all queries in project. Is there any solution without project refactoring?
| |
Sitecore has only one OOTB feature that uses Cortex and it is Personalization Suggestions in ContentTesting.
If you do not use Content Testing, you can disable it with setting in Sitecore.ContentTesting.config:
<setting name="ContentTesting.AutomaticContentTesting.Enabled" value="false" />
If it does not help, try to disable Sitecore.ContentTesting.* configs.
P.S. Almosl all Cortex references are related to Processing server role, but ContentTesting is linked to many roles: ContentManagement, ContentDelivery, Reporting, Processing. Keep this in mind as you use scaled topology.
| How to disable all Cortex services
I want to disable all Cortex services in my 10.2 XP1 environment.
I am getting the following in the log Connection string 'cortex.processing.engine' is not found. Because there is no Cortex Processing engine, and thus no connection string, but I don't know how to configure my instance so that it does not look for that connection string and any others relating to Cortex.
Here's the full error:
11788 13:42:56 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: An unhandled exception occurred.
Source: Sitecore.Mvc
at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.ShowErrorMessage(ExceptionContext exceptionContext, ExceptionArgs args)
at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.Process(ExceptionArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Filters.PipelineBasedRequestFilter.OnException(ExceptionContext exceptionContext)
at System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at Sitecore.Mvc.Routing.RouteHttpHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: System.InvalidOperationException
Message: Error while rendering view: '/sitecore/shell/client/Speak/Layouts/Layouts/Speak-Layout.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').
Source: Sitecore.Mvc
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Presentation.RenderingView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult)
Nested Exception
Exception: System.InvalidOperationException
Message: Error while rendering view: '/sitecore/shell/client/Sitecore/ExperienceEditor/PageEditbar/PageEditBar.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').
Source: Sitecore.Mvc
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Helpers.SitecoreHelper.RenderPlaceholderCore(String placeholderName, TextWriter writer)
at Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName)
at ASP._sitecore_shell_client_Speak_Layouts_Layouts_Speak_Layout_cshtml.Execute()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
Nested Exception
Exception: System.InvalidOperationException
Message: Error while rendering view: '/sitecore/shell/client/Sitecore/Speak/Ribbon/Controls/QuickBar/QuickBar.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').
Source: Sitecore.Mvc
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Helpers.SitecoreHelper.RenderPlaceholderCore(String placeholderName, TextWriter writer)
at Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName)
at Sitecore.ExperienceEditor.Speak.PageEditbar.PageEditBar.Render(HtmlTextWriter output)
at Sitecore.Web.UI.Controls.ComponentBase.Render()
at Sitecore.ExperienceEditor.Speak.PageEditbar.ControlsExtension.PageEditBar(Controls controls, Rendering rendering, HtmlHelper`1 htmlHelper)
at ASP._Page_sitecore_shell_client_Sitecore_ExperienceEditor_PageEditbar_PageEditBar_cshtml.Execute() in d:\websites\site.cm\sitecore\shell\client\Sitecore\ExperienceEditor\PageEditbar\PageEditBar.cshtml:line 4
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
Nested Exception
Exception: System.InvalidOperationException
Message: Error while rendering view: '/sitecore/shell/client/Sitecore/Speak/Ribbon/Controls/QuickbarButton/QuickbarButton.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').
Source: Sitecore.Mvc
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Extensions.EnumerableExtensions.Each[T](IEnumerable`1 source, Action`1 action)
at Sitecore.Web.UI.Controls.Common.ItemRenderers.ItemRenderer.RenderItem(TextWriter output, Item item)
at Sitecore.Web.UI.Controls.Common.ItemRenderers.ItemRenderer.Render(HtmlTextWriter output)
at Sitecore.Web.UI.Controls.ComponentBase.Render()
at Sitecore.ExperienceEditor.Speak.Ribbon.Controls.QuickBar.QuickBar.DoRender(HtmlTextWriter output)
at Sitecore.Web.UI.Controls.ComponentBase.Render()
at Sitecore.ExperienceEditor.Speak.Ribbon.Controls.QuickBar.ControlsExtension.QuickBar(Controls controls, Rendering rendering)
at ASP._Page_sitecore_shell_client_Sitecore_Speak_Ribbon_Controls_QuickBar_QuickBar_cshtml.Execute() in d:\websites\site.cm\sitecore\shell\client\Sitecore\Speak\Ribbon\Controls\QuickBar\QuickBar.cshtml:line 4
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
Nested Exception
Exception: System.TypeInitializationException
Message: The type initializer for 'Sitecore.ExperienceEditor.Speak.Ribbon.Controls.RibbonButtonBase' threw an exception.
Source: Sitecore.ExperienceEditor.Speak.Ribbon
at Sitecore.ExperienceEditor.Speak.Ribbon.Controls.RibbonButtonBase.GetProcessComponentState()
at Sitecore.ExperienceEditor.Speak.Ribbon.Controls.RibbonButtonBase.PreRender()
at Sitecore.ExperienceEditor.Speak.Ribbon.Controls.RibbonIconButtonBase.PreRender()
at Sitecore.Web.UI.Controls.ComponentBase.Render()
at Sitecore.ExperienceEditor.Speak.Ribbon.Controls.QuickbarButton.ControlsExtension.QuickbarButton(Controls controls, Rendering rendering)
at ASP._Page_sitecore_shell_client_Sitecore_Speak_Ribbon_Controls_QuickbarButton_QuickbarButton_cshtml.Execute() in d:\websites\site.cm\sitecore\shell\client\Sitecore\Speak\Ribbon\Controls\QuickbarButton\QuickbarButton.cshtml:line 4
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
Nested Exception
Exception: System.TypeInitializationException
Message: The type initializer for 'Sitecore.ExperienceEditor.Speak.Server.RequestRepository' threw an exception.
Source: Sitecore.ExperienceEditor.Speak
at Sitecore.ExperienceEditor.Speak.Server.RequestRepository..ctor()
at Sitecore.ExperienceEditor.Speak.Ribbon.Controls.RibbonButtonBase..cctor()
Nested 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.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters)
at Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateObject[T](XmlNode configNode)
at Sitecore.ExperienceEditor.Speak.Server.RequestRepository.Get()
at Sitecore.ExperienceEditor.Speak.Server.RequestRepository..cctor()
Nested Exception
Exception: System.Configuration.ConfigurationErrorsException
Message: Connection string 'cortex.processing.engine' is not found.
Source: Sitecore.Processing.Engine.Client
at Sitecore.Processing.Engine.Client.WebApiProcessingEngineClient.EnsureConnectionString(String name)
at Sitecore.Processing.Engine.Client.WebApiProcessingEngineClient.CreateHttpClient()
at Sitecore.Processing.Engine.Client.WebApiProcessingEngineClient..ctor(ILogger`1 logger)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Sitecore.ContentTesting.Requests.ExperienceEditor.ShowSuggestedPersonalizationDialogRequest..ctor()
| |
The official documentation shows the new API for this.
Basically:
Inject Sitecore.Analytics.Tracking.Identification.IContactIdentificationManager to your class
Code:
var result = identificationManager.IdentifyAs(new Sitecore.Analytics.Tracking.Identification.KnownContactIdentifier("twitter", "myidentifier"));
if(!result.Success)
{
//check result.ErrorCode and result.ErrorMessage for more details
}
| Tracker.Current.Session.IdentifyAs Removed
We are working through upgrading from 9.1 to 10.2, changing various API calls where there are now removed methods, etc.
One method's update we are having trouble locating is Tracker.Current.Session.IdentifyAs - we are using this method to track contacts as part of a service. Can anyone assist with what might be the replacement for this method in 10.2?
| |
I tried this on my local using these steps.
You need to run this command before creating your app.
npm install @sitecore-jss/sitecore-jss @sitecore-jss/sitecore-jss-nextjs
Now use this command to create your app.
npx create-sitecore-jss nextjs
This is what I get in the temp folder and also contains the config.js file that is missing at your end.
Hope this will work for you.
| Next Js create app JSS command
I tried both the below commands to create a JSS next js app but none of it has all the required files in the app.
npx create-sitecore-jss nextjs
npm init sitecore-jss nextjs
When I do jss:build, it says src->temp->config.js is missing and other serialized items are missing.
Can someone help me with the correct next js jss command to create an app?
I am using JSS 20.0 version in Sitecore 10.2 Containerized instances.
Thanks,
Shakti
| |
Site names in SXA are not stored in configuration files. You can check out the SXA Site Manager found under the Toolbox to see what is available. You can use the Sitecore API to query for the sites.
| Get site name in config file
Is it possible to get current running site name in .config or patch file in multiple site in Sitecore SXA ?
I did not find anything related to it.
| |
I have written this script by using this example.
This is my Sitecore item with an RTE field and some anchor tags.
Now, this is the script I used, and if you want you can modify this as per your needs.
# Get your item here by providing ID
$rootItem = Get-Item -Path "master:" -ID "{56305117-8C9C-4C08-96D5-BB97A8E27419}"
# Regex pattern to check if the value contains any anchor
$anchorTagPattern = '(?is)<a[^>]*>(.*?)<\/a>';
# Get your RTE Field
$richTextContent = $rootItem.Fields["DB"].Value;
# Match parttern with your RTE field value
$anchorTagPatternMatches = [regex]::Matches($richTextContent, $anchorTagPattern);
# If Pattern matches
if(![string]::IsNullOrEmpty($anchorTagPatternMatches)) {
# Create a loop and it will give you all the anchors in your RTE
ForEach ($patterns in $anchorTagPatternMatches) {
# Check if anchor contains the text you want (mention your text)
if($patterns -like '*testlink*')
{
# Keep that anchor in new variable by replacing text with your new value
$newValue = $patterns -replace "testlink", "newLink"
# Replace this new anchor with old anchor in your RTE field
$richTextContent = $richTextContent.Replace($patterns,$newValue);
# Update your RTE with new value
$rootItem.Editing.BeginEdit();
$rootItem.Fields["DB"].Value = $richTextContent;
$rootItem.Editing.EndEdit();
}
}
}
And the output is this. It has updated two anchors that match my value.
| How to update the anchor link text in rich text field using Sitecore Powershell?
I would like to update the anchor link text, if the anchor link Href match with particular domain/url. Do we have any sitecore powershell script to update the same?
| |
I found the fix of this issue
1- create a new patch
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore role:require="Standalone or ContentManagement or ContentDelivery" search:require="solr">
<links>
<itemUrlBuilder>
<patch:attribute name="type">Mysite.Foundation.Multisite.Pipelines.NavigationItemUrlBuilder, Mysite.Foundation.Multisite</patch:attribute>
</itemUrlBuilder>
</links>
</sitecore>
</configuration>
2- Implement the ItemUrlBuilder
public class NavigationItemUrlBuilder : ItemUrlBuilder
{
public NavigationItemUrlBuilder(DefaultItemUrlBuilderOptions defaultOptions) : base(defaultOptions)
{
}
public override string Build(Item item, ItemUrlBuilderOptions options)
{
//enable the Language Embedding for non- english languages
options.LanguageEmbedding = item.Language.Name.Equals("en") ? Sitecore.Links.LanguageEmbedding.Never : Sitecore.Links.LanguageEmbedding.Always;
var RegionName = item.Language.CultureInfo.TwoLetterISOLanguageName.ToLower() ?? "";
return item.Language.Name.Equals("en") ? base.Build(item, options) : base.Build(item, options).ToLower().ReplaceFirst(item.Language.Name.ToLower(), RegionName);
}
}
| SXA language embedding
I'm working on an SXA multilingual site, and I've enabled the embed language option, now I can see the URL in the navigation has language code + region code
Example:
mysite/fr-fr/mypage
mysite/it-it/mypage
But I want to display the URL without the region code
To be like the following :
mysite/fr/mypage
mysite/it/mypage
Any idea please?
| |
I found the answer. I needed to add https://www.basic-company-aspnetcore.localhost/ to the Project.BasicCOmpany.config file and now the CSS is showing up correctly in CM.
| Sitecore Helix .Net Core example CSS not showing up in CM
I am hoping someone has encountered this before. I am working with this helix example -
https://github.com/Sitecore/Helix.Examples/blob/master/examples/helix-basic-aspnetcore/README.md
and I have a question related to this site when running on CM. The styles show up correctly when the site is published and I view the live local URL of https://www.basic-company-aspnetcore.localhost.
But when I try previewing on CM or using the experience editor the CSS and JS are trying to use a URL of http://rendering/css/basic-company.css
I am sure it's just something that I missed in the setup but am having trouble locating the issue. Any help would be appreciated thanks.
| |
I would rebuild indexes and especially sxa master index one.
Works for me without trouble.
I have added second one to test:
and it's shown properly in EE:
You should see it also in Edit style dialog:
| Rendering variants for 'Page Content' SXA rendering not showing
I have added a few Rendering Variants for the SXA rendering Page Content (SS below)
But, when I try to use this rendering on the page from the Experience Editor the dropdown for the Rendering Variant is not visible.
What am I missing?
| |
Based on this post, it's a bug in Docker Desktop for Windows. Running docker-compose restart rendering cm before you refresh the page will allow it to load properly. I know this doesn't exactly "fix" the issue, but it seems to work.
| Sitecore Helix .Net Core example publishing/build errors
When making any edits to the cshtml files. I get a bad gateway error on CD and on CM I get a The operation has timed out error. So far the only way to get the sites working again, is doing a docker-compose down and then docker-compose up -d. Then the site responds correctly and also shows the change I made too.
| |
You can use below PowerShell script for create a new item version and update field value
# Get All items under particular node with specific template name
$items = Get-ChildItem -Path "master:/sitecore/content/Home" -Recurse | Where-Object { $_.TemplateName -eq 'Template Name' }
# Loop all items
foreach ($item in $items)
{
# Get item to update and create new item version
$itemToUpdate = Add-ItemVersion -ID $item.ID -Language en -IfExist Append
$itemToUpdate.Editing.BeginEdit()
$itemToUpdate.Fields["Button Text"].Value = "Button Text Mew"
$itemToUpdate.Editing.EndEdit()
}
I tested it on my Sitecore instance and it's working as expected, please try it.
You can get more information about creating new item version from below URL as well.
https://doc.sitecorepowershell.com/appendix/common/add-itemversion
| How to add new version before updating the field values using Sitecore Powershell?
I have to update field values to a particular item. Instead of changing the item's final version, I would like to create a new version and do my updates. For ex: if en(v2) is the latest, I need to create en(v3) and update my changes.
Is there any PowerShell script to update this?
| |
I faced the same issue recently. 2 solutions I can suggest -
Disable TLS 1.3 over TCP for xconnect. Rerun the installation script or disable this as soon as the xconnect bindings are setup by script during installation. for reference - https://sandeeppote.com/2021/11/14/step-by-step-guide-to-install-sitecore-xp-10-2-using-sif-on-windows-11/
After applying the above changes still I faced the issue so I uninstall WAC. After this, I started the installation again and it was successful.
| Error while installing Sitecore 10.2, Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred while sending the request
`C:\inetpub\wwwroot\sul6xconnect.dev.local\App_Data\jobs\continuous\AutomationEngine\Sitecore.MAEngine.exe`
Starting Marketing Automation Engine... 2022-06-21 10:20:10 ERR Error
initializing XConnect client. System.AggregateException: One or more
errors occurred. --->
Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred
while sending the request. --->
Sitecore.Xdb.Common.Web.ConnectionTimeoutException: A task was
canceled. ---> System.Threading.Tasks.TaskCanceledException: A task
was canceled. at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of inner exception stack trace --- at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Polly.CircuitBreaker.CircuitBreakerEngine.<ImplementationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at Polly.Policy`1.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteGetAsync>d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__7.MoveNext()
--- End of inner exception stack trace --- at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.XConnect.Client.XConnectClientConfiguration.<InitializeAsync>d__34.MoveNext()
--- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean
includeTaskCanceledExceptions) at
System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,
CancellationToken cancellationToken) at
Sitecore.XConnect.Client.Configuration.XConnect.Extensions.ServiceCollectionExtensions.InitializeXConnectClientConfiguration(IServiceProvider
provider, XConnectClientConfiguration config)
---> (Inner Exception #0) Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred
while sending the request. --->
Sitecore.Xdb.Common.Web.ConnectionTimeoutException: A task was
canceled. ---> System.Threading.Tasks.TaskCanceledException: A task
was canceled. at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of inner exception stack trace --- at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Polly.CircuitBreaker.CircuitBreakerEngine.<ImplementationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at Polly.Policy`1.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteGetAsync>d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__7.MoveNext()
--- End of inner exception stack trace --- at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Sitecore.XConnect.Client.XConnectClientConfiguration.<InitializeAsync>d__34.MoveNext()<---
ERROR System.InvalidOperationException: This configuration has not
been initialized. Please call the initialize method before using it.
at
Sitecore.XConnect.Client.XConnectClientConfiguration.CheckInitialized()
at
Sitecore.XConnect.Client.XConnectClientConfiguration.get_CurrentModel()
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite
callSite, RuntimeResolverContext context, ServiceProviderEngineScope
serviceProviderEngine, RuntimeResolverLock lockType) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite
singletonCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite
callSite, ServiceProviderEngineScope scope) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope
scope) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider
provider) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider
provider, Type instanceType, Object[] parameters) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite
callSite, RuntimeResolverContext context, ServiceProviderEngineScope
serviceProviderEngine, RuntimeResolverLock lockType) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite
singletonCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite
callSite, ServiceProviderEngineScope scope) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope
scope) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider
provider) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider
provider, Type instanceType, Object[] parameters) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite
callSite, RuntimeResolverContext context, ServiceProviderEngineScope
serviceProviderEngine, RuntimeResolverLock lockType) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite
singletonCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite
callSite, ServiceProviderEngineScope scope) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope
scope) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider
provider) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider
provider, Type instanceType, Object[] parameters) at
Sitecore.XConnect.Configuration.Extensions.<>c__DisplayClass33_0.<UseServiceDecorator>b__1(IServiceProvider
provider) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite
callSite, RuntimeResolverContext context, ServiceProviderEngineScope
serviceProviderEngine, RuntimeResolverLock lockType) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite
singletonCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite
callSite, ServiceProviderEngineScope scope) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope
scope) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider
provider) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider
provider, Type instanceType, Object[] parameters) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite
transientCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite
enumerableCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitNoCache(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite
callSite, ServiceProviderEngineScope scope) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope
scope) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider
provider) at
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider
provider, Type instanceType, Object[] parameters) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite
callSite, RuntimeResolverContext context, ServiceProviderEngineScope
serviceProviderEngine, RuntimeResolverLock lockType) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite
singletonCallSite, RuntimeResolverContext context) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite
callSite, TArgument argument) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite
callSite, ServiceProviderEngineScope scope) at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope
scope) at
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider
provider) at
Sitecore.Xdb.MarketingAutomation.Engine.App.ServiceConfiguration.get_Engine()
at
Sitecore.Xdb.MarketingAutomation.Engine.App.Program.RunAsConsoleApp(Boolean
interactive)
| |
You can follow the below steps to test this scenario :-
Create two Sitecore items in Content Editor, one is Page 01 and second is Page 02. On Page 01 in the Content Editor add content in rich text field and
create an anchor tag on Page 2 text for Page 02 item.
Now , open this page in Experience Editor. You can see the anchor tag on Page 2.
Delete Page 02 in Content Editor and it will open dialog box, select Leave links option.
When, you will open Page 01 in Experience editor and click on the link then LinkItemNotFoundUrl setting will call and will open /sitecore/service/notfound.aspx page.
| Where are we use LinkItemNotFoundUrl setting
We have a setting under Sitecore.config file.
<setting name ="LinkItemNotFoundUrl" value ="/sitecore/service/notfound.aspx" />
Could someone assist me real time scenario when this setting will hit the page?
| |
After restoring db from production to your local environment, clean EventQueue and History tables in both core and master databases.
Otherwise, your local instance will try to process every single entry from those tables at startup and that will pretty much make it unresponsive if you have plenty of entries there.
| Sitecore Content Management warm up issue in 8.2 update 7 website
We have an issue whenever we restore production DBs to QA/local environment our Content management doesn't come up though content delivery is all fine
What I did so far:
Earlier we noticed that our Core/EventQueue table had lots of entries so we reduced agent's time to 4 hours and can see the effect(Not too many rows) but still it's failing. Any help would be appreciated
| |
You can use below PowerShell script for text search
$startPath = "web:/sitecore/content/home"
Write-Host "Search started $(Get-Date -format 'u')"
$linkProvider = [LM.Lightcore.Links.LinkProvider]::new()
$urlOptions = [Sitecore.Links.UrlOptions]::new();
$list = @()
$itemsToProcess = Get-ChildItem $startPath -Language * -Recurse
if($itemsToProcess -ne $null) {
$itemsToProcess | ForEach-Object {
$match = 0;
foreach($field in $_.Fields) {
if($field -match '.*http://*') {
$item = Get-Item ("web:" + $_.ID)
$info = [pscustomobject]@{
"FullPath"=$_.Paths.FullPath
"ItemUrl"=$linkProvider.GetItemUrl($item, $urlOptions)
}
$list = $list+$info
}
}
}
}
Write-Host "Search ended $(Get-Date -format 'u')"
Write-Host "Items found: $($list.Count)"
$list | Show-ListView -Property @{Label="FullPath"; Expression={$_.FullPath} },
@{Label="ItemUrl"; Expression={$_.ItemUrl} }
Please try it, it will provide you list of items with item URL.
| How to take list of http:// or https:// link referenced in our Sitecore content tree using Sitecore Powershell?
I would like to take a list of external links (http:// or https://) referenced in our website from our Sitecore content tree.
I need to compare with all Sitecore Fields(Rich text, general link, single link text, multiline text, etc) and take the list.
Is there any Powershell script to get the list?
| |
Yes, it's possible. But you need to be careful in the Azure VM you select for this. I generally recommend a D8s_V3.
The key here is, the VM needs to support Nested Virtualization.
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization
To my knowledge, the Dsv3 and Dv3 series is the lowest tier that supports this.
https://docs.microsoft.com/en-us/azure/virtual-machines/dv3-dsv3-series
I would recommend 32 GB ram and Premium Storage options, especially if you want to run a Docker based environment.
| Sitecore 10.2 on Azure Virtual machine
I am new to Sitecore and trying to create a Sitecore development environment. I was planning to build an Azure Virtual machine with Windows 11 Pro N, 16 GB RAM. Just wanted to confirm that If we can have Sitecore 10.2 on Azure VM (Virtualization, docker on windows), is it supported and any challenges someone has faced?
| |
Sitecore query functions make it possible to perform Boolean operations with Items in query expressions and apply extra conditions to the query.
You can use startswith function:
Function: startswith(s1:string,s2:string):bool
Description: Indicates whether s1 starts with substring s2. The comparison is case-sensitive.
Query Example:
query:/sitecore/content/home//*[startswith(@@name, 'Item')]
Returns child Items of the Home Item whose name starts with Item .
| How to get the closest items in the Sitecore tree?
I would like get the closest list of items, if the items starts with particular name in the sitecore tree.
In the tree, if i am in Item page, i have to take all the closest items start with Item
ItemDummy1
ItemDummy2
ItemDummy3
ItemDummy4
Do we have any fastest query to fetch the list?
| |
For this, I found some discrepancies which are as follows:
As per the screenshot above for the sitecore.json the package Sitecore.DevEx.Extensibility.Serialization was at version 3.0.0 but when I checked the Sitecore CLI version in PowerShell by command dotnet sitecore --version, then it was showing 4.1.0, so I upgraded the package from 3.0.0 to 4.1.0 to make it compatible with current CLI version.
Still, error was not resolved:
Then, I found somewhere that deleting the .sitecore/user.json file works so I deleted the user.json file and from PowerShell used the command for non-interactive Sitecore login to save the login information in the new user.json (created by command) and tried the ser pull.
Still, the error was there then:
I checked that the package for Sitecore Management Services that I had installed in the Sitecore was with version 4.1.1 so I downloaded the package with 4.1.0 and then installed it into the Sitecore and tried again with ser pull.
Still, the error was there then:
I noticed that there are two different config patches for the claimsMapping in my local, so I removed the irrelevant one and kept the one suggested by the steps as per the article https://doc.sitecore.com/xp/en/developers/102/developer-tools/configure-a-non-interactive-client-login.html
Still, the error was there, and then finally:
I checked that in my non-interactive command I was passing the --auth and --cm without https:// so I again deleted the user.json and used the non-interactive Sitecore login command, but now with https:// and then again tried the ser pull command and it worked.
| Unable to run Sitecore CLI Serialization push command
I am trying to run the dotnet sitecore ser push command after non-interactive login (login works fine), but only ser push and ser pull command give the following error otherwise all the ser command like explain, info, validate etc, works fine.
This is the error:
PS C:\RSMRepo> dotnet sitecore ser push
Unhandled exception: System.Exception: Unhandled exception
---> System.AggregateException: One or more errors occurred. (Specified argument was out of the range of valid values. (Parameter 'baseUri')) (Specified argument was out of the range of valid values. (Parameter 'baseUri')) (Specified argument was out of the range of valid values. (Parameter 'baseUri'))
---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'baseUri')
at System.Uri..ctor(Uri baseUri, String relativeUri)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.SitecoreApiClient.<>c__DisplayClass13_0.<<RunQuery>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequestInternal(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 80
at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 25
at Sitecore.DevEx.Configuration.Authentication.ClientCredentialsAuthenticationProvider.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\ClientCredentialsAuthenticationProvider.cs:line 89
at Sitecore.DevEx.Configuration.Models.EnvironmentConfiguration.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Models\EnvironmentConfiguration.cs:line 182
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.SitecoreApiClient.RunQuery(String servicePath, GraphQLRequest request, Boolean assertNoErrors, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.ExecuteSingleBatchQuery[T](String batchQueryFragment, TreeScope scope, ItemSpec[] specs, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.<>c__DisplayClass19_0`1.<<CreateParallelQuery>b__0>d.MoveNext()
--- End of inner exception stack trace ---
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.CreateParallelQuery[T](String parallelQueryFragment, TreeScope scope, ItemSpec[] specs, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.GetTreeNodesInternal(IEnumerable`1 itemSpecs, TreeScope scope, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.Initialize(CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.TreeSyncOperation.Initialize(CancellationToken cancellationToken)
at Sitecore.DevEx.Extensibility.Serialization.Tasks.TreeSyncOperationExecutor.ExecuteTreeSyncOperation(TreeSyncOperation operation, Boolean whatIf, Boolean performValidation, SyncDirection direction, CancellationToken cancellationToken)
at Sitecore.DevEx.Extensibility.Serialization.Tasks.SyncTask.Execute(SyncTaskOptions options)
at Sitecore.DevEx.Extensibility.Serialization.Commands.SyncCommandBase.Handle(SyncTask task, SyncArgs args)
at Sitecore.Devex.Client.Cli.Extensibility.Subcommands.SubcommandBase`2.HandleInternal(TArgs args) in C:\BA\ca7111d945a16af4\src\Sitecore.Devex.Client.Cli.Extensibility\Subcommands\SubcommandBase.cs:line 75
---> (Inner Exception #1) System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'baseUri')
at System.Uri..ctor(Uri baseUri, String relativeUri)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.SitecoreApiClient.<>c__DisplayClass13_0.<<RunQuery>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequestInternal(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 80
at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 25
at Sitecore.DevEx.Configuration.Authentication.ClientCredentialsAuthenticationProvider.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\ClientCredentialsAuthenticationProvider.cs:line 89
at Sitecore.DevEx.Configuration.Models.EnvironmentConfiguration.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Models\EnvironmentConfiguration.cs:line 182
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.SitecoreApiClient.RunQuery(String servicePath, GraphQLRequest request, Boolean assertNoErrors, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.ExecuteSingleBatchQuery[T](String batchQueryFragment, TreeScope scope, ItemSpec[] specs, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.<>c__DisplayClass19_0`1.<<CreateParallelQuery>b__0>d.MoveNext()<---
---> (Inner Exception #2) System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'baseUri')
at System.Uri..ctor(Uri baseUri, String relativeUri)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.SitecoreApiClient.<>c__DisplayClass13_0.<<RunQuery>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequestInternal(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 80
at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 25
at Sitecore.DevEx.Configuration.Authentication.ClientCredentialsAuthenticationProvider.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\ClientCredentialsAuthenticationProvider.cs:line 89
at Sitecore.DevEx.Configuration.Models.EnvironmentConfiguration.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Models\EnvironmentConfiguration.cs:line 182
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.SitecoreApiClient.RunQuery(String servicePath, GraphQLRequest request, Boolean assertNoErrors, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.ExecuteSingleBatchQuery[T](String batchQueryFragment, TreeScope scope, ItemSpec[] specs, CancellationToken cancellationToken)
at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.<>c__DisplayClass19_0`1.<<CreateParallelQuery>b__0>d.MoveNext()<---
--- End of inner exception stack trace ---
at Sitecore.Devex.Client.Cli.Extensibility.Subcommands.SubcommandBase`2.HandleExceptionMessageConsoleLogging(Exception exception, ILogger logger) in C:\BA\ca7111d945a16af4\src\Sitecore.Devex.Client.Cli.Extensibility\Subcommands\SubcommandBase.cs:line 120
at Sitecore.Devex.Client.Cli.Extensibility.Subcommands.SubcommandBase`2.HandleInternal(TArgs args) in C:\BA\ca7111d945a16af4\src\Sitecore.Devex.Client.Cli.Extensibility\Subcommands\SubcommandBase.cs:line 81
at System.CommandLine.Invocation.CommandHandler.GetResultCodeAsync(Object value, InvocationContext context)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass24_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__21_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseExceptionHandler>b__0>d.MoveNext()
Below is the environment detail:
Sitecore version: 10.2 XP0
Sitecore CLI version: 4.1.0
Sitecore.json looks like below:
Please let me know if something else is required for your idea and provide help around fixing the ser push command error.
| |
After doing a lot of workaround on this issue, we finally resolved the issue with the suggestion from Sitecore Support Team.
Basically this was a JSS issue where it is unable to render the page.The issue occurs in cases when the JSS application works in the Integrated Mode.
As per the Sitecore Article https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1000535
Setting the value of the "ConnectFailureNodeRestart" configuration to "true" on all of your Sitecore instances, resolved my issue.
By default, the property is defined in the following file: App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.ViewEngine.Node.config.
You can also set the value by creating a configuration patch file in the \App_Config\Include\zzz folder.
Note: It is always a best practise to have all default configuration changes through patch config.
| Intermittent "Unable to connect remote server" on Azure hosted sitecore 10.2 site
We have a Sitecore 10.2 site hosted on Azure App services. Very often site is getting down with the blank page throwing error Unable to connect remote server. If we refresh multiple times, then site will be up but it will keep on coming same error till we restart the service.
This behaviour has been observed over QA and Pre-prod environments also.
Any possible way to fix this issue?
| |
Sitecore support can provide the definite answer to see what would all break for example the in session personalization as mentioned by Kate. However here are some pointers which might be useful from my own experience:
I would be surprised if something core to the CD would break as Sitecore mentions setting SessionState to ReadOnly here. (With ReadOnly session state nothing will be updated in Session outside the scope of the Request)
At scale the session state data store itself or the locking mechanism can easily become a significant bottleneck for the site, and disabling session can be an excellent way to prevent this.
Support for aspnet:AllowConcurrentRequestsPerSession is on Sitecore's roadmap which can alleviate the locking issue if that is your concern
| Disable Session State on CD Servers
For a CMS Only Sitecore CD server (No xDB Tracking), is there any requirement to enable session state?
What standard Sitecore services would fail if there was no session state?
| |
First, ensure you have Sitecore Remoting enabled.
Next, ensure the restfulv1 service is enabled (NOTE: I just set up the admin user for a quick and dirty example):
<powershell>
<services>
<restfulv1>
<patch:attribute name="enabled">true</patch:attribute>
<authorization>
<add name="isadmin" Permission="Allow" IdentityType="Role" Identity="sitecore\IsAdministrator" />
<add name="superuser" Permission="Allow" IdentityType="User" Identity="sitecore\superuser" />
</authorization>
</restfulv1>
<remoting>
<patch:attribute name="enabled">true</patch:attribute>
<authorization>
<add name="isadmin" Permission="Allow" IdentityType="Role" Identity="sitecore\IsAdministrator" />
<add name="superuser" Permission="Allow" IdentityType="User" Identity="sitecore\superuser" />
</authorization>
</remoting>
</services>
</powershell>
The following Powershell script provides the backbone for uploading a PDF via a standard HTTP Request:
$parentMediaFolder = "$([Sitecore.Constants]::MediaLibraryPath)/Files/"
$fileName = $scriptArguments["fileName"]
$fileNameNoExtension = [System.IO.Path]::GetFileNameWithoutExtension($fileName);$mediaCreatorOptions = New-Object Sitecore.Resources.Media.MediaCreatorOptions
$mediaCreatorOptions.Database = [Sitecore.Configuration.Factory]::GetDatabase("master")
$mediaCreatorOptions.Versioned = [Sitecore.Configuration.Settings+Media]::UploadAsVersionableByDefault;
$mediaCreatorOptions.Destination = $parentMediaFolder + $fileNameNoExtension$mediaCreator = New-Object Sitecore.Resources.Media.MediaCreator$createdMediaItem = $mediaCreator.AttachStreamToMediaItem($($requestStreams.Values)[0], $parentMediaFolder + $fileNameNoExtension, $fileName, $mediaCreatorOptions)
write-host $createdMediaItem.ID
Add this script to Sitecore.
Usage:
Use Postman to construct a request with these settings:
Verb: POST
URL: https://cminstance.local/sitecore%20modules/PowerShell/Services/RemoteScriptCall.ashx
Query String parameters:
script: the full path to the SPE script
sc_database: master
apiVersion: 1 (this is a toggler for a variety of functions available in the RemoteScriptCall service, we need 1 in order to execute a script)
fileName: A custom parameter. We can add as many as we need. This includes the file extension. This is sent to the SPE script.
Body: Choose "form-data", add a "KEY" named "File" and modify the "VALUE" value and choose a PDF to attach to the request.
Authorization (tab): Select "Basic auth"
Enter the username as "sitecore\<username>" and the password
Response: The ID of the item that was added. By default, if the file name is a match, it updates the existing item and does not create a new item.
| How To Upload File To Remote Sitecore Instance Via Web Request
I am attempting to upload a PDF file to Sitecore as a single web request and have it added to the media library. I would like to choose a parent folder and have all requests generate a PDF at that location with the provided file name.
It appears that SPE is capable of such a feat, but the similar questions/blogs that I've found thus far do not quite provide the answers I'm looking for.
| |
Working example from 9.3
$removeEmails = @("[email protected]","[email protected]")
foreach ($email in $removeEmails) {
$account = "Storefront\$email"
if (Test-Account -Identity $account)
{
$account | Remove-User
Write-Output "Removed: $account"
}
else
{
Write-Output "Not found user: $account"
}
}
| Sitecore Powershell Test-Account -Identity breaks with email as username
I am in need to iterate through a list of emails (that happen to be username in Sitecore CMS) and then remove the users. I would like to have an "if" statement to see if account is present before attempting to remove it.
# list of emails, one per line, ex. "[email protected]"
$removeEmails = Get-Content C:\AccountsToRemove.txt
foreach ($email in $removeEmails) {
$account = "Storefront\$($email)"
if (Test-Account -Identity $account)
{
$email | Remove-User
Write-Output "Removed: '$email'"
}
}
But I get PowerShell complaining as follows:
Test-Account : Cannot bind parameter 'Identity'. Cannot convert value "Storefront\[email protected]" to type "Spe.Commands.Security.AccountIdentity". Error: "The name
'Storefront\[email protected]' is improperly formatted.
The name can only contain the following characters: a-z, 0-9, periods, dashes, underscores, backslashes, and spaces.
Parameter name: name"
How do I overcome this issue?
Thank you for your help in advance!!
UPDATE:
I found a thread mentioning that RegEx is too restrictive: Cannot add a User to a Role where the User name contains the "@" sign using PSE
Hopefully issue will be resolved in some next version.
Still same issue in Sitecore PowerShell Extensions 6.3.0.17327
Windows PowerShell 5.1
(Sitecore 9.3)
BUT if anyone can think of a workaround... please help!!
and no,
Get-User -Filter * | Where-Object {$_.Profile.Email -like "[email protected]"} | Remove-User
is not viable with over million users - Sitecore CM hangs like crazy. This is based of post here: https://munirhassan.com/2021/03/29/remove-sitecore-users-from-the-core-database/
NOTE 1 (sitecore domain)
Was able to add user with email as username after easing restrictions with:
<setting name="AccountNameValidation" value=".+" />
and running the script (user is in "sitecore" domain: "sitecore\[email protected]")
NOTE 2 (Storefront domain with plus)
NOTE 3 (Storefront domain no plus)
| |
The issue was resolved by doing the following steps:
Created self-signed root certificate with the below PowerShell script;
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "DO_NOT_TRUST_SitecoreRootCert" -FriendlyName "DO_NOT_TRUST_SitecoreRootCert" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
Copied this certificate from Personal to Trusted Root Certification Authorities inside local machine certificate store
| Sitecore10 installation error: CertEnroll::CX509PrivateKey::Create: Object already exists. 0x8009000f
I am getting the below error while installing Sitecore 10. Can someone please help me to remove this so that I can reinstall a fresh instance?
Thanks!
log:
[ IdentityServerCertificates_CreateR... : NewRootCertificate ------------------]
Could not find Cert: DO_NOT_TRUST_SitecoreRootCert in Cert:\LocalMachine\Root
CertEnroll::CX509PrivateKey::Create: Object already exists. 0x8009000f (-2146893809 NTE_EXISTS)
[TIME] 00:00:12
CertEnroll::CX509PrivateKey::Create: Object already exists. 0x8009000f (-2146893809 NTE_EXISTS)
| |
The problem was config code (that I failed to add to the question), nevertheless I will add as an answer to this, on the off chance anyone has a similar issue.
The repo I was using, was originally created to interact with Sitecore 9.1. In this version, the config required to add a custom model takes the format:
<Settings>
<Sitecore>
<XConnect.Client>
<Services>
<Client.Configuration>
<Options>
<Models>
<!-- Configure the xConnect client to include the custom model. -->
<MusicModel>
<TypeName>ProcessingEngineDemo.XConnectExtensions.MusicModel, ProcessingEngineDemo.XConnectExtensions</TypeName>
<PropertyName>Model</PropertyName>
</MusicModel>
</Models>
</Options>
</Client.Configuration>
</Services>
</XConnect.Client>
</Sitecore>
</Settings>
Reference here: https://github.com/adeneys/cortex-processing-demo/blob/master/Processing%20Engine%20Extensions/App_Data/Config/Sitecore/Demo/sc.Customizations.xml
The issue I had, is that it seems the config structure changed when moving to Sitecore 10.1.2 (which is the version I was using). When I updated it to the form as below the event was recognised:
<Settings>
<Sitecore>
<XConnect>
<Services>
<XConnect.Client.Configuration>
<Options>
<Models>
<CourseCollectionModel>
<TypeName>ProcessingEngineDemo.XConnectExtensions.MusicModel, ProcessingEngineDemo.XConnectExtensions</TypeName>
</CourseCollectionModel>
</Models>
</Options>
</XConnect.Client.Configuration>
</Services>
</XConnect>
</Sitecore>
</Settings>
Note that XConnect.Client is renamed XConnect, and Client.Configuration is renamed XConnect.Client.Configuration.
| Searching for events of custom model type in XConnect
I have cloned this repo and updated it to run with Sitecore 10.1 (which is our current version):
https://github.com/adeneys/cortex-processing-demo
The above application has functionality to create a custom model 'MusicPurchaseOutcome' and generate the necessary JSON to deploy to Xconnect (which I have deployed to App_data/Models). The above model also maps to a Outcome which I have created in Sitecore and deployed.
The application also allows to register mock interactions into XConnect using this custom model. The code to do this can be seen below:
var xConnectClient = await CreateXConnectClient();
var contactId = new ContactIdentifier("music", Guid.NewGuid().ToString(), ContactIdentifierType.Known);
var contact = new Contact(contactId);
contacts.Add(contact);
var album = albums[random.Next(0, 3)];
var outcome = new MusicPurchaseOutcome(DateTime.Now, "GBP", 20)
{
Album = album
};
var interaction = new Interaction(contact, InteractionInitiator.Contact, _channelId, "music kiosk 1.0");
interaction.Events.Add(outcome);
xConnectClient.AddContact(contact);
xConnectClient.AddInteraction(interaction);
await xConnectClient.SubmitAsync();
I can confirm that this successfully adds an interaction to XConnect, example below shows the value in 'Events' column of an interaction:
[{"@odata.type":"#ProcessingEngineDemo.XConnectExtensions.MusicPurchaseOutcome","CustomValues":[],"DefinitionId":"01de8c58-ac29-4bd7-a893-fc2d853bd53e","Id":"3b8feb8f-b7de-441c-9265-cf8c8f997c58","Timestamp":"2022-06-27T07:20:20.2615588Z","CurrencyCode":"GBP","MonetaryValue":"20","Album":{"ArtistName":"Muse","ArtistId":"12Chz98pHFMPJEknJQMWvI","AlbumName":"Drones","AlbumId":"2wart5Qjnvx1fd7LPdQxgJ"}}]
The problem I am facing is when I come to search XConnect and try to return contacts that have interactions of this new custom type. Using the code below:
var xConnectClient = await CreateXConnectClient();
var query = xConnectClient.Contacts.Where(contact =>
contact.Interactions.Any(interaction =>
interaction.Events.OfType<MusicPurchaseOutcome>().Any() && interaction.EndDateTime > DateTime.UtcNow.AddMinutes(-TimeoutIntervalMinutes)
)
);
var expandOptions = new ContactExpandOptions
{
Interactions = new RelatedInteractionsExpandOptions()
};
query = query.WithExpandOptions(expandOptions);
var batchEnumerator = await query.GetBatchEnumerator();
System.Console.WriteLine($"Found {batchEnumerator.TotalCount} interactions");
while (await batchEnumerator.MoveNext())
{
foreach (var contact in batchEnumerator.Current)
{
System.Console.WriteLine("====================================");
System.Console.WriteLine($"Contact ID {contact.Id}");
var outcomes = contact.Interactions.SelectMany(i => i.Events.OfType<MusicPurchaseOutcome>());
foreach (var outcome in outcomes)
{
var album = outcome.Album;
System.Console.WriteLine("------------------------------------");
System.Console.WriteLine($"Album Id: {album.AlbumId}");
System.Console.WriteLine($"Album Name: {album.AlbumName}");
System.Console.WriteLine($"Artist Id: {album.ArtistId}");
System.Console.WriteLine($"Artist Name: {album.ArtistName}");
}
}
}
The above code returns 0 contacts. However, if I change the call to XConnect (line 4) to get of type 'Event':
Events.OfType<Event>
The second call (line 22):
Events.OfType<MusicPurchaseOutcome>()
Is able to successfully identify those events that are of type 'MusicPurchaseOutcome'. I can only assume that the custom model isnt correctly deployed somehow, which is why it isnt working in the remote call. But the second call works because it is performed locally after it has been returned from XConnect?
There are no exceptions being registered in the logs when I make the above calls to XConnect.
Any suggestions on what might be causing the initial call to fail would be greatly appreciated.
| |
The first issue seems to be known, see the full list here, so I suggest to contact Sitecore Support for any available patches for your specific version.
The second problem typically occurs when a component is inserted into a non existing placeholder, therefore, I suggest to check on the following things:
Ensure that your placeholder definition has been added to the manifest via
addPlaceholder(...templates: template[])
Make sure that component definition is present correctly in the manifest
addComponent({
name: 'SomeComponent',
placeholders: ['jss-main1']
});
Review the route data, it should be aligned with your placeholder & component definition, for example, /data/component-content/SomeComponent/someid/en.yml
id: someid
fields:
pageTitle: Some page title
placeholders:
jss-main1:
- componentName: SomeComponent
...
Double check that the component has been created with the correct placeholder at a code level
| No fields and placeholder received from Layout API on JSS
I just started developing JSS applications last week and was using the JSS version 13 since our Sitecore version is 9.3 and look for some help with issues I encountered so far.
I tried to deploy sitecore-embedded-js-app as is to my instance by running jss deploy config, jss deploy files, jss deploy app -c -d and I got the config set to the appropriate paths. The templates, renderings, placeholder setting, and items were imported successfully.
However, when I checked the app in Experience Editor Preview I saw an error that says A rendering error occurred: Cannot read properties of undefined (reading 'data'). Upon checking, I saw no properties inside the fields object of the route props. The script breaks on the Wizard.js' render function:
const childSteps = rendering.fields.data.item.children;
{
databaseName: "master",
displayName: "Wizard",
fields: {},
itemVersion: 1,
name: "wizard",
placeholders: {,…},
templateName: "EmbeddedWizard Route",
}
What could be the cause of this?
Secondly, when I check the app on web (or even when I run it on Connected mode), I get a blank page. Upon inspection, the API is not returning a list of placeholders. I have tried everything from republishing, renaming the placeholder key, to indexing the content tree but neither of these fixed the issue. On debug, I encounter an error that says:
Placeholder 'jss-main1' was not found in the current rendering data{
databaseName: "web",
displayName: "Wizard",
fields: {},
itemVersion: 1,
name: "wizard",
placeholders: {},
templateName: "EmbeddedWizard Route",
}
Has anyone encountered these issues as well? Any ideas on how to solve this would be great.
EDIT: Included the breaking code for the missing data property
| |
The RequiredApiKey attribute is in a separate package and namespace Sitecore.Services.Infrastructure.Security. I can't see from your screenshot whether you've added a reference to Sitecore.Services.Infrastructure.Sitecore, and if you have this in your using declarations:
using Sitecore.Services.Infrastructure.Security;
| How to use OData API key with custom integrated API .NET 4.8 MVC controller?
https://doc.sitecore.com/xp/en/developers/91/sitecore-experience-manager/api-keys-for-the-odata-item-service.html
https://www.linkedin.com/pulse/sitecore-api-key-throttle-series-2-md-arifuzzaman-arif/
Referring back to these links I tried using [RequiredApiKey] however it's never getting recognized as a class attribute on the controller:
| |
I haven't tried that but maybe adding your own processors at the beginning and at the end of <getContentEditorFields> pipeline would do the trick?
And then using
Sitecore.Diagnostics.PerformanceCounters.DataCount.DataItemsAccessed.Value
to get the number of items read - you can store the initial value in Sitecore.Context.Items cache as it is a per-request cache, and then compare it with the value at the end of pipeline.
| Is there some way to measure number of items read per item in the Content Editor
I'm wondering if there is any diagnostic tool, or technique which can be used to work out how many items are read from the DB for each item loaded in the content editor. I'm thinking of a Content Editor equivalent of the rendering statistics admin page. I know I could look at all inherited templates and look at any fields which are link fields or TreeList fields (or similar) and perhaps figure out how many queries/requests there are, but it would be pretty tedious.
My end goal is to quantitatively measure the benefit of changing certain field types from e.g. TreeList to TreeListEx to see how this will affect Content Editor performance.
| |
If you like to add the referenced items into your package using PowerShell then you need to use Get-ItemReference to get all the referenced items of the item that you want to include in your package. And then you need to loop through all the items to put them into your package and then the package will be created with the referenced items that you need. So the code should be something like this.
# Pass your item ID
$items = Get-ItemReference -ID "{56305117-8C9C-4C08-96D5-BB97A8E27419}"
$package = New-Package "Sitecore Package";
# Set package metadata
$package.Sources.Clear();
$package.Metadata.Author = "Sumit";
$package.Metadata.Publisher = "Sumit";
$package.Metadata.Version = "1.0";
$package.Metadata.Readme = 'Readme Text'
# Loop on all the related items and add into the package
ForEach ($item in $items) {
$source = $item | New-ExplicitItemSource -Name 'Your Page Name' -InstallMode Overwrite
$package.Sources.Add($source);
}
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip
# Offer the user to download the package
Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"
Hope this will help.
Some useful links.
How to create a package.
https://doc.sitecorepowershell.com/appendix/packaging/new-package
Get item references.
https://doc.sitecorepowershell.com/appendix/common/get-itemreference
Get Item Renderings
https://doc.sitecorepowershell.com/working-with-items/item-renderings
| How to take content item package with all referenced items using Sitecore Powershell?
I would like to create package of one single content item using Sitecore PowerShell Extensions. While creating the package, I would like to include all the referenced items in the package. Is there any script available to solve this task?
I know only the content item path, in that I need to include referenced template, media,etc.
| |
Okay, I did get this fixed. What we ultimately did was copy the entire CM (the whole folder structure) site from another working environment, minus the web.config, and it started working. So, no clue what killed it, but that was the fix for anyone who finds this.
| CM IIS 503 Error
Getting a 503 on my CM site in IIS (server 2012) - I have checked all the settings for the app pool, file systems permissions, etc. Checked all the logs that I know and tried using procmon to see if I could spot something causing the issue. This was working fine and suddenly stopped working in our dev environment.
All other sites/app pools are working on this server - it's just this one site that won't start. I tried switching the CM site to an app pool that is working on another site.
Any ideas?
| |
One of the most comment approaches is using httpRequestBegin pipeline. You should be aware that this pipeline is called not only for pages though.
If you use mvc, you can use mvc.requestBegin pipeline
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<mvc.requestBegin>
<processor type="MyAssembly.MyNamespace.MyProcessor, MyAssembly"
patch:after="processor[@type='Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking, Sitecore.Mvc.Analytics']"
resolve="true">
</processor>
</mvc.requestBegin>
</pipelines>
</sitecore>
</configuration>
public class MyProcessor : RequestBeginProcessor
{
public override void Process(RequestBeginArgs args)
{
}
}
EDIT
If you want to call a Controller Action on every single page, add code like below to cshtml file of your Layout:
Html.Sitecore().Controller("Controller Name", "Controller Action")
| Call Action Method in all pages using Pipelines?
Is it possible to use Pipelines and call specific action method in every page?
Im trying to build a Modal Popup based on User IP it will redirected user to user-specific country.
But this Action Method needs to be called from everypage.
I'm still wrapping my brain around how the process will invoke my action?
| |
Reached out to Sitecore support and looks like it is a bug with Sitecore 10.2 OOB. Email campaign Model was not registered properly in Automation engine. After adding below configuration to <Models> node of "sc.XConnect.Client.xml", The issue was fixed.
<EmailCollectionModel>
<TypeName>Sitecore.EmailCampaign.Model.XConnect.EmailCollectionModel, Sitecore.EmailCampaign.Model</TypeName>
<PropertyName>Model</PropertyName>
</EmailCollectionModel>
The xml file is present here - \App_Data\jobs\continuous\AutomationEngine\App_Data\config\sitecore\XConnect
Thanks,
Rashmi
| SItecore Marketing automation is not working for OOB email opened event
I have created a Marketing Automation campaign and selected Send Email action for contacts. Post this action, I am adding a listener for 3 minutes where I have added a rule "Where contact opened any email" or "where contact opened email 'email'" . The email is getting sent but the listener is not getting passed.
When I checked the Experience Profile of the contact, I am seeing the Email opened event getting triggered. PFB screenshot,
But for some reason in the Marketing Automation flow, this is not working. When I checked the logs in AutomationEngine folder, I am getting below errors,
2022-07-03 13:37:27.944 -04:00 [Error] Failed to submit context.
Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred while sending the request. ---> Polly.CircuitBreaker.BrokenCircuitException: The circuit is now open and is not allowing calls. ---> Sitecore.Xdb.Common.Web.ConnectionTimeoutException: A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of inner exception stack trace ---
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Polly.CircuitBreaker.CircuitBreakerEngine.<ImplementationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Polly.Policy`1.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of inner exception stack trace ---
at Polly.CircuitBreaker.CircuitStateController`1.OnActionPreExecute()
at Polly.CircuitBreaker.CircuitBreakerEngine.<ImplementationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Polly.Policy`1.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of inner exception stack trace ---
at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Sitecore.XConnect.Client.Operations.HttpOperationInvoker.<Execute>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__108.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__108.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.XConnect.XdbContext.<SubmitAsync>d__75.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.XConnect.Diagnostics.XdbContextCountersDecorator.<SubmitAsync>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.MarketingAutomation.Loading.AsyncXdbLoader.<LoadContactsAndInteractionsAsync>d__14.MoveNext()
2022-07-03 13:37:27.949 -04:00 [Error] Failed to load contact '{0}'.
Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred while sending the request. ---> Polly.CircuitBreaker.BrokenCircuitException: The circuit is now open and is not allowing calls. ---> Sitecore.Xdb.Common.Web.ConnectionTimeoutException: A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of inner exception stack trace ---
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Polly.CircuitBreaker.CircuitBreakerEngine.<ImplementationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Polly.Policy`1.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of inner exception stack trace ---
at Polly.CircuitBreaker.CircuitStateController`1.OnActionPreExecute()
at Polly.CircuitBreaker.CircuitBreakerEngine.<ImplementationAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Polly.Policy`1.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of inner exception stack trace ---
at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Sitecore.XConnect.Client.Operations.HttpOperationInvoker.<Execute>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__108.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__108.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.XConnect.XdbContext.<ExecuteAsync>d__72.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.XConnect.XdbContext.<GetAsync>d__64`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.XConnect.Diagnostics.XdbReadOnlyContextCountersDecorator.<GetAsync>d__32`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.MarketingAutomation.Loading.AsyncXdbLoader.<LoadContactsAsync>d__13.MoveNext()
When I am creating a Segmented List using the same rule, it is working perfectly fine. But it is not working in MA. I have checked Predicate XML in Automation engine folders and it looks good. Any suggestions ?
Thanks,
Rashmi
| |
We triaged to a Sitecore bug and they have a work around for this. Hope this helps.
https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1001423
| Adding Image to Rich Text Editor
While adding images to Rich Text Editor's body field, they are getting added but not in the desired position. All images are getting added to the Top of RTE.
For example: I need to add an image in line 10 and I placed the cursor at line 10, clicked on "Insert Sitecore Media" and selected the image from media library. I see that the image is added to Line 1 of the RTE body and not in Line 10. I need to again move those images to that position. How to fix this?
| |
Have created the Custom WEB DB entries in /App_Data/items and /Sitecore Modules/items folder like master/web/core. It resolved my issue.
| Sitecore 10.2 upgrade - Some sitecore folders are not displaying
We are doing Sitecore upgrade from 9.2 to 10.2. When we reusing the same new publishing targets in upgrade, we couldn't able to see the Layout/Templates/System folders.
We can see that, if we can place the DB name in Web DB connection string.
| |
Yes, it is possible through Sitecore Powershell script. Write your logic like this.
# get item to archive and provide the version. Examle 3
$item = Get-Item -Path "master:" -Uri "sitecore://master/{6151ACBE-40C3-45D5-BCE8-5E939C461C12}?lang=en&ver=3"
[Sitecore.Data.Archiving.ArchiveManager]::GetArchives($item.Database)
$archive = [Sitecore.Data.Archiving.ArchiveManager]::GetArchive("archive", $item.Database)
$archive.ArchiveVersion($item)
$archive.GetEntries(0,10)
Now when you go to the Archive window, you will see the version you have archived.
| Is it possible to achieve Sitecore item version?
I want to archive Sitecore item version and not the entire item using Powershell script.
I could not find the way to archive version, articles are there to archive item but not the specific version. Also could not find the command in PowerShell documentation. https://doc.sitecorepowershell.com/
I tried ArchiveItem($item) but it archives the entire item and not the version alone.
Can some one guide me to find the solution on this query?
Thanks,
| |
Basic reasons behind your problem could be either wrong naming convention of your controller or routing issues.
If you added a "Controller" word to your controller file name then this could be why, so simply rename your file and remove the "Controller" word from it.
Routing is important to match URI to an expected action, so ensure that you use the Routing attribute to define routes in C#. For any custom routes, make sure that they don't conflict with the default Sitecore routes and create your custom processor with the relevant config settings to add it to the "initialize" pipeline.
| Sitecore 9.3 JSS - controller for path '/api/jss/formbuilder' was not found
I'm trying to apply my Sitecore Form on my JSS application through the Forms API. The form was rendered properly, but when I tried to submit I got this error:
What could be the cause of this? My Sitecore version is 9.3 and my npm packages for sitecore-jss-react and sitecore-jss-react-forms is ^13.2.2 which is the appropriate version for my Sitecore instance.
| |
In a layman term,
Item Resolver: Sitecore checks the requested URL and decide which Sitecore Item from Sitecore content tree need to server to the client.
Content Resolver: Content Resolver has business logic to generate content (JSON for layout service) for the rendering/component.
| What is the difference between Content Resolver and Item Resolver
Could someone explain the difference between Content Resolver and Item Resolver?
I see for Content Resolver, we create the resolver item in sitecore modules whereas for Item Resolver, we add it in patch file.
I feel both does the same job. Please clarify.
| |
I used following approach to overcome this issue.
Used Developer Tab > Serialize Tree to serialize content
Created a zip of serialized content and moved to server
Used Developer Tab > Update Tree to deserialize content
Faced slow serialization issue
Googled and found that this is an issue and Sitecore has hotfix for it
Applied hotfix
Re-ran deserialization using Developer Tab > Update Tree
Done
| Specified argument was out of the range of valid values
I am trying to move media items from local machine to dev server via Sitecore packages and I getting errors while installing it.
I have two separate packages, one for media images (size 4.6GB) and another one is for media files(pdf,docs etc) (size 2.47GB) and getting different errors with both these packages.
Source and target Sitecore Version - 9.3.0
Any thoughts?
Could not read signature - no data!
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Could not read signature - no data!
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Exception: Could not read signature - no data!]
Sitecore.Zip.ZipEntry.ReadSignature(Stream s) +157
Sitecore.Zip.ZipEntry.ReadHeader(Stream s, ZipEntry ze, Encoding nameEncoding) +29
Sitecore.Zip.ZipEntry.Read(Stream s, Encoding nameEncoding) +45
Sitecore.Zip.<get_Entries>d__8.MoveNext() +81
Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink) +548
Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.LoadPackage() +436
Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.ActivePageChanging(String page, String& newpage) +93
Sitecore.Web.UI.Pages.WizardForm.set_Active(String value) +106
Sitecore.Web.UI.HtmlControls.Button.DoClick(Message message) +60
[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.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89
Sitecore.Web.UI.HtmlControls.Component.HandleMessage(Message message) +195
Sitecore.Shell.Framework.Commands.ClientEventCommand.SendEventMessage() +131
Sitecore.Shell.Framework.Commands.ClientEventCommand.Execute(CommandContext context) +16
Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent() +98
Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +806
System.Web.UI.Control.PreRenderRecursiveInternal() +200
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7479
Specified argument was out of the range of valid values.
Parameter name: count
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: count
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: count]
System.IO.Compression.DeflateStream.ValidateParameters(Byte[] array, Int32 offset, Int32 count) +217
System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count) +47
Sitecore.Zip.Utils.LimitedReadOnlyStream.Read(Byte[] buffer, Int32 offset, Int32 count) +104
Sitecore.Install.StreamUtil.Copy(Stream from, Stream to, Int32 bufferSize) +59
Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink) +256
Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.LoadPackage() +436
Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.ActivePageChanging(String page, String& newpage) +93
Sitecore.Web.UI.Pages.WizardForm.set_Active(String value) +106
Sitecore.Web.UI.HtmlControls.Button.DoClick(Message message) +60
[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.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89
Sitecore.Web.UI.HtmlControls.Component.HandleMessage(Message message) +195
Sitecore.Shell.Framework.Commands.ClientEventCommand.SendEventMessage() +131
Sitecore.Shell.Framework.Commands.ClientEventCommand.Execute(CommandContext context) +16
Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent() +98
Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +806
System.Web.UI.Control.PreRenderRecursiveInternal() +200
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7479
| |
I think the issue is related to Content Resolver.
Please verify your code and make sure you selected correct Layout service in your JSON rendering as shown in below screenshot
| JSS Dynamic Placeholder - some components are missing
I have a component with a jss-form placeholder inside it. I added two renderings with different placeholder signatures to make it into a Dynamic Placeholder. These are as follows:
FormA: /jss-main/jss-form-{b0898e09-ea46-48b0-becb-03f97a38f493}-0
FormB: /jss-main/jss-form-{b0898e09-ea46-48b0-becb-03f97a38f493}-1
I have set two placeholder settings on my main component's presentation details
jss-main
jss-form
However, the Layout Service only returns FormA under jss-form:
Therefore this:
<Placeholder name="jss-form" rendering={rendering} />
<Placeholder name="jss-form" rendering={rendering} />
Becomes:
<FormA />
<FormA />
But if I change the signature of FormB to that of FormA, I get both of them twice!
<FormA />
<FormB />
<FormA />
<FormB />
I'm using Sitecore 9.3 and I'm doing a Sitecore-first approach with the Embedded JSS application, so I manually create my placeholders and renderings and stuff. Can anyone point out where I did wrong here?
| |
My rule of thumb is: Use it only if you really need to.
Publishing Service (SPS) improves publishing speed a lot. It's super fast in comparison with the built-in publisher. However, it has its draw backs. Besides adding complexity (one more service and module) to the solution, it has had its issues over the years. I've run into so many bugs in it. Though some of them have been fixed now, there are plenty left.
The built-in publisher is quite db chatty, so number of items and versions do count a lot. Latency plays a big role here as well. From what I remember, the built-in one also publishes to one target at a time while SPS publishes in parallel. SPS also publishes in bulk, reducing latency issues as well.
Even though SPS comes with a new UI etc., it's really only about speed. It also limits your ability to extend the publishing process (which should be avoided anyway).
If you're at a scenario where SPS would help a lot, you could actually have it sort of installed in "parallel". If the core:/sitecore/system/Aliases/Applications/Publish item is renamed to something else, it will disable SPS and you can run with the built-in one. Thereby you can compare the two and also evaluate if SPS does its job properly.
When comparing the two, it's also good to know that some operations related to publishing are executed async. For example index updates, item events, cache clearing etc. With the built-in publisher, this is mostly not seen. This is because those events are usually executed faster than it takes to publish an item. When running SPS, all those events still occur. This means that the SPS UI may say a publish is complete, but in fact a lot of events are still being executed in the background. This can lead to frustrating among editors not seeing their recently published updates and maybe trigger more publishes etc.
I wrote some notes about this a few years ago. It's a bit dated but most of it is still relevant: https://mikael.com/2019/07/learnings-from-a-year-of-implementing-sitecore-publishing-service/
| When is it a good idea to use Publishing Service?
I'm looking for a rule of thumb based on some real-world experiences on whether to use Sitecore Publishing Service or not.
Things that probably need to be considered:
number of items
number of item language versions
how frequently items change
number of publishing targets
latency from the CM server to the publishing targets
I would presume a combination of the above would lead to considerable time savings if Publishing Service were used, just looking for some rough numbers?
| |
I have the same problem as you. Referring to Sumit's reply, I have made the following modifications. Now it works for me. My Sitecore version is 9.3
Update the files as Sumit said. These files under \<yoursiteroot>\Tools\AuditTrail
Move the AuditTrail folder from \<yoursiteroot>\Tools to \<yoursiteroot>\sitecore
Update the \<yoursiteroot>\App_Config\Include\SCBasics.AuditTrail.config
Note: The above three steps are enough. Simultaneously, I found an incompatibility issue with multisite. So I have updated the ForSite.aspx.cs to fix it. If necessary, the following code for your reference:
public partial class ForSite : Sitecore.sitecore.admin.AdminPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request.QueryString["id"]))
LoadSiteAuditTrailDetails(HttpUtility.UrlDecode(Request.QueryString["id"]));
}
}
private void LoadSiteAuditTrailDetails(string ItemID)
{
SCAuditLogsDataContext scAuditLogsDataContext =
new SCAuditLogsDataContext();
Database masterDb = Sitecore.Configuration.Factory.GetDatabase("master");
Item currentItem = masterDb.GetItem(ItemID);
var currentSiteName = currentItem.GetContextSite().Name;
IOrderedQueryable<Log> logs =
scAuditLogsDataContext.Logs.Where(x =>
x.SiteName == currentSiteName).
OrderByDescending(x => x.Date);
if (logs == null && !logs.Any())
{
ShowMessage("No audit trail records found, it seems that you haven't configured SCAuditTrail or no actions recorded yet.",
"Error");
lblMessage.Visible = true;
tblSCAuditTrailForSite.Visible = false;
}
else
{
foreach (Log aLog in logs)
{
if (aLog != null)
{
TableRow tableRow = new TableRow();
tableRow.ID = "row" + aLog.ID.ToString();
tableRow.TableSection = TableRowSection.TableBody;
//Action
SCBasics.AuditTrail.Utils.UIControlUtil.AddTableCell(tableRow,
aLog.SCAction,
SCBasics.AuditTrail.Utils.SourceTextType.Text);
//UserName
SCBasics.AuditTrail.Utils.UIControlUtil.AddTableCell(tableRow,
aLog.SCUser,
SCBasics.AuditTrail.Utils.SourceTextType.Text);
//Date
SCBasics.AuditTrail.Utils.UIControlUtil.AddTableCell(tableRow,
aLog.Date.ToUniversalTime().ToString(),
SCBasics.AuditTrail.Utils.SourceTextType.DateTime);
// ItemID
SCBasics.AuditTrail.Utils.UIControlUtil.AddTableCell(tableRow,
aLog.SCItemId,
SCBasics.AuditTrail.Utils.SourceTextType.Text,
aLog.SCItemPath);
//ItemLanguage
SCBasics.AuditTrail.Utils.UIControlUtil.AddTableCell(tableRow,
aLog.SCLanguage,
SCBasics.AuditTrail.Utils.SourceTextType.Text);
// ItemVersion
SCBasics.AuditTrail.Utils.UIControlUtil.AddTableCell(tableRow,
aLog.SCVersion,
SCBasics.AuditTrail.Utils.SourceTextType.Text);
tblSCAuditTrailForSite.Rows.Add(tableRow);
}
}
lblMessage.Visible = true;
tblSCAuditTrailForSite.Visible = true;
}
}
private void Page_Error(object sender, EventArgs e)
{
// Get last error from the server
Exception exc = Server.GetLastError();
Response.Write("Oops something went wrong : " + exc.Message);
Sitecore.Diagnostics.Log.Error("SC Audit Trail For Item : " + exc, this);
Server.ClearError();
}
/// <summary>
/// This function will be used
/// to show message
/// </summary>
/// <param name="message">Message to show</param>
/// <param name="messageType">Message type to show</param>
private void ShowMessage(string message, string messageType)
{
lblMessage.Visible = true;
lblMessage.Text = message;
if (messageType == "Error")
{
lblMessage.CssClass = "alert alert-danger";
}
else
{
lblMessage.CssClass = "alert alert-success";
}
}
}
| Audit Trail Error, Login Page Not Found
I'm getting an error while opening the audit trail popup window, does anyone know how to fix this error? It got stop working suddenly.
Sitecore version is: 10.1.0
Log error message:
ManagedPoolThread #0 19:35:40 WARN Number of suppressed logs due to the minimum time between log entries: 7
43932 19:35:41 ERROR No login page specified for current site: EchoPark (method: Sitecore.Web.UI.Sheer.ClientPage.OnInit(EventArgs e)).
43932 19:35:41 ERROR SC Audit Trail For Item : System.Exception: No login page specified for current site: EchoPark (method: Sitecore.Web.UI.Sheer.ClientPage.OnInit(EventArgs e)).
at Sitecore.Diagnostics.Error.Raise(String error, String method)
at Sitecore.Web.WebUtil.RedirectToLoginPage(HttpContext httpContext, List`1 queryParametersToRemove)
at Sitecore.Web.UI.Sheer.ClientPage.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
| |
Nothing really changed between version 8.0 and 9.3 when it comes to statistics of Sitecore items.
When you copy items, values like "Created" are not updated.
So if you need them to be updated, you should write your custom code or use the code from the blog post you found.
| Sitecore Statistics for item copied / duplicated
The items that are newly created by copying or duplicating have the same Statistics (Created Date, Created By, Updated Date, Updated By, Revision) as their originals. The same happens with their children items that were copied or duplicated together with them.
When researched, found a blog that provides an ItemCopiedEventHandler workaround; however it was designed for an older version of Sitecore(8.0). We are currently in 9.3.
Can anyone share your thoughts on this?
| |
Yes, you need to go to this Sitecore Item and update the rule to add your custom rendering template.
/sitecore/system/Settings/Rules/Insert Options/Rules/MVC Renderings
| How to add custom rendering button to Renderings node
I have duplicated the Controller rendering template to create a custom rendering here - /sitecore/templates/System/Layout/Renderings/
Is it possible to add this as an insert option to the renderings node.
| |
You can try the following things, to make it work.
Update your password: Using the SQL management studio you will need to connect to the database server and then run the below command to modify the password.
ALTER USER securityuser WITH PASSWORD = 'your-password'
Add role to a user: You need to execute sp_addrolemember procedure with 'db_owner' and 'securityuser' parameters like that:
EXEC sp_addrolemember 'db_owner', 'masteruser'
Either of the ones might resolve your issue.
| Not able to login via Sitecore identity Server in Sitecore 10.1
We have set up Sitecore 10 environment. It was working properly but suddenly it stopped authenticating and started giving error.
We are getting below error everytime we try to log in
Login failed for user 'securityuser'
is there anything we need to check in Sitecore Core DB for this user?
Thanks in advanced.
| |
Most of the prebuilt dashboards have very specific usecases that they are showing data for. There are a few dashboards that allow you to pull the CSV of the data, however most do not provide access to the raw data including the specific guests that matched in that report.
Sounds like however, you are looking for more of the raw data that you can get inside an S3 bucket of your Sitecore CDP Data Lake. This is not provided out of the box, however you can reach out to Sitecore support to provide this raw data to you, so that you can create your own dashboards (using Power BI, Tableau or any Business Intelligence software) for your organization, or use this data to explore specific trends. This data is provided to you on a daily basis and you can move to your own S3 buckets or do with that data as you wish.
You can learn more about the Data Lake export service here in the Sitecore Documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-0/using-sitecore-cdp-data-lake-export-service.html
New link: https://doc.sitecore.com/cdp/en/developers/api/data-lake-export-service.html
| Sitecore CDP Dashboard Report
I am exploring the Sitecore CDP dashboard. In the Summary Report it is showing number of reports like Guest Type, New Visitors, Converted, Abandoned etc. reports. I want to further drill down the report to see the user details. However I could not find a way to get the details of users. Even if downloading the reports don't contains user info.
Please let me how I can achieve this.
| |
It may happen that some of the versions have been deleted or archived. So the screenshot that you added is showing the latest version number which is 81. But if anyone has removed or archived a version between them then Sitecore doesn't reset the count.
For example, here in this screenshot, I have five versions of an item so it's showing the latest version i.e 5.
But I have deleted versions 2 and 3 and if I open the version panel then it shows only those that exist for this item like in the image.
And when I run the below PowerShell script then it shows the correct version count i.e 3.
I think you need to verify and you will get the context.
Hope this helps.
| How can I count all existing versions of an item in Sitecore Powershell Extensions?
When I go to the content editor I can see that the Home item has 81 versions, but when I'm counting its versions in Sitecore Powershell Extensions I'm getting 79 versions as a result.
What am I doing wrong?
The script that I'm using to count the versions is quite simple and it's returning 79 as a result
$item = Get-Item -Path master:\path-tho-the-item\home -Language * -Version *
Write-Host $item.Versions.Count
| |
Conclusion
After looping in Sitecore support and comparing the GraphQL and Solr responses. The issue appears to be rooted in the Solr query parser's ability to rank results based on the _content computed field.
Under the covers, when you populate the keyword argument for the Sitecore.Services.GraphQL.Content.Queries.SearchQuery class is using the LINQ Contains() operator which adds a WHERE clause to the query parameter passed to Solr like this:
q=_content:"*caffeine*"
Because the _content field is a computed field that aggregates content from several different text and media fields, the default query parser is unable to appropriately rank the results.
In my case, this is a deal-breaker for using GraphQL for keyword and faceted search.
Best Alternative (although not supported by the Content Search API)
The DisMax query parser is designed to process simple phrases (without complex syntax) entered by users and to search for individual terms across several fields using different weighting (boosts) based on the significance of each field. Additional options enable users to influence the score based on rules specific to each use case (independent of user input).
In general, the DisMax query parser’s interface is more like that of Google than the interface of the 'standard' Solr request handler. This similarity makes DisMax the appropriate query parser for many consumer applications. It accepts a simple syntax, and it rarely produces error messages.
https://solr.apache.org/guide/8_8/the-dismax-query-parser.html#the-dismax-query-parser
| GraphQL Search Query non-Edge
I'm using a non-edge GraphQL endpoint to leverage keyword search and faceting in my content search queries. This means that I'm using the Sitecore.Services.GraphQL.Content.Queries.SearchQuery class instead of the Sitecore.Services.GraphQL.EdgeSchema.Queries.SearchQuery that comes with the Edge schema.
My query looks like this:
query( $language: String = "en"
$keyword: String!
$first: Int = 10
$after: String
) {
search(
rootItem: "/sitecore/content/Client/MainSite/Home",
keyword: $keyword,
first: $first,
after: $after,
fieldsEqual:[
{name:"_haslayout", value:"true"},
{name:"_latestversion", value:"true"},
{name:"_language", value: $language}
],
) {
results {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
items {
score
item {
displayName
template {
name
}
}
}
}
}
}
I get results back, but the relevancy is unclear. The biggest thing that I notice is that the score field is the same for every result item.
{
"data": {
"search": {
"results": {
"totalCount": 3,
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false
},
"items": [
{
"score": 4.8768038749694824,
"item": {
"displayName": "Health benefits of coffee",
"template": {
"name": "Article"
}
}
},
{
"score": 4.8768038749694824,
"item": {
"displayName": "Dr. Pepper",
"template": {
"name": "Person"
}
}
},
{
"score": 4.8768038749694824,
"item": {
"displayName": "Nespresso",
"template": {
"name": "Product"
}
}
}
]
}
}
}
}
Has anyone run into this and figured out how to correct it?
| |
What you can update in your code is to first get the value of the Final Rendering Field (That you are already doing). Here is an example.
$rootItem = Get-Item -Path "master:" -ID "{B485F716-9E95-42E8-8DE0-844E988A1BDF}"
$layoutfield = $rootItem.Fields["__Final Renderings"].value
And then cast this value into XML.
$xmlData = [xml]($layoutfield)
So your XML will become like this. (I used an online tool to convert string raw value into HTML to see how it looks)
<?xml version="1.0" encoding="UTF-8"?>
<r xmlns:p="p" xmlns:s="s" p:p="1">
<d id="{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}">
<r uid="{67FD787F-0E4F-4F59-9EC9-67AC9A5F588D}" p:before="*" s:ds="{C0B095E6-4F35-4208-8209-AAB9446A7BD7}" s:id="{3972C278-7E7A-4C2B-A293-66AF860F5C3A}" s:par="Reset Caching Options&amp;GridParameters=%7B908E2BC6-C110-4ED7-AF39-7EEACBB31A34%7D&amp;FieldNames=%7B4D608918-2AB2-48BC-AE4E-A8886991E6E3%7D&amp;Styles&amp;CacheClearingBehavior=Clear%20on%20publish&amp;RenderingIdentifier&amp;DynamicPlaceholderId=2" s:ph="footer" />
<r uid="{9D547A21-EE39-4A78-9652-84CF9DB532E9}" p:after="r[@uid='{67FD787F-0E4F-4F59-9EC9-67AC9A5F588D}']" s:ds="local:/Data/carousel" s:id="{5A21C781-8E74-4DD0-8261-8CCDA1BF0454}" s:par="Navigation=%7B848DFE42-2B13-430E-A0B9-89CE25730A06%7D&amp;Transition=%7BD4B706CC-7EEC-4DB9-A87D-123B29803490%7D&amp;Timeout=2000&amp;PauseOnHover=1&amp;Reset Caching Options&amp;GridParameters=%7B908E2BC6-C110-4ED7-AF39-7EEACBB31A34%7D&amp;Styles&amp;CacheClearingBehavior=Clear%20on%20publish&amp;RenderingIdentifier&amp;DynamicPlaceholderId=1" s:ph="main" />
<r uid="{83732FD0-718A-4637-AC13-84940164A9C9}" s:ds="" />
</d>
</r>
Loop through your XML like this and update the value of p:after and p:before with your value using SetAttribute function.
foreach($node in $nodes) {
$node.SetAttribute("p:after", "your-id")
}
Finally using this command you will get back your updated XML into a string.
$xmlData.OuterXml
Update this string raw value into your Final Rendering Field.
And That's it.
Hope this will help you.
| Retrieving "p:after" in layout via Sitecore Powershell Extentions
I am trying to retrieve these values found in the "final renderings" field:
p:after and p:before.
But I can't seem to find them anywhere. Is there a way to get them out?
The reason I need those, is I am taking some renderings, that are nested inside another "columns" rendering and pulling them out. Unfortunately this means they are getting placed differently than before, as the "columns" rendering has the p:after placement set. I would like to transfer this from the "columns" rendering to the first nested rendering.
Simplified PowerShell script I am testing:
$rootItem = Get-Item master:"/content";
$renderings = @('{521F66ED-76BC-4C40-9D8D-9FC23145FC80}', # Container deck 3 column
'{8278046D-8762-4F1F-916C-07ECEC2EE9C7}') # Virksom 3 column deck
$defaultLayout = Get-LayoutDevice "Default"
foreach($renderingId in $renderings) {
$oldRendering = Get-Item -Path "master:" -ID $renderingId
Get-ChildItem $rootItem.FullPath -recurse -Language "da" | ForEach-Object {
$itemPath = $_.Paths.ContentPath
$sourceRenderings = Get-Rendering -Item $_ -Device $defaultLayout -FinalLayout | Where-Object { $_.ItemID -eq $renderingId -And -Not([string]::IsNullOrEmpty($_.Datasource)) }
if ($sourceRenderings -ne $null) {
foreach($sourceRendering in $sourceRenderings) {
$column1 = Get-Rendering -Item $_ -Device $defaultLayout -FinalLayout | Where-Object { $_.Placeholder -eq "/main/virksom-content/deck-column-1-$($sourceRendering.UniqueID)-0" }
foreach($col in $column1)
{
#tried to find it here
#Write-Host ($col| Format-List | Out-String)
#tried to find it here, probably the same as before
$finalLayoutField = $_.Fields[[Sitecore.FieldIDs]::FinalLayoutField]
$finalLayoutXml = [Sitecore.Data.Fields.LayoutField]::GetFieldValue($finalLayoutField)
$finalLayout = [Sitecore.Layouts.LayoutDefinition]::Parse($finalLayoutXml)
$renderings = $finalLayout.Devices[0].Renderings
Write-Host ($renderings| Format-List | Out-String)
#nothing in Dynamic Properties
#foreach($dynamicProperty in $col.DynamicProperties)
#{
#$propertyName = $dynamicProperty.ToString()
#$text = $dynamicProperty.Value
#Write-Host("$($propertyName) - $($text))");
#}
# new placeholder, that is no the old dynamic placeholder
$placeholder = $col.Placeholder
$placeholderLength = $placeholder.Length
$placeholderLastIndexOfSlash = $placeholder.LastIndexOf('/')
$placeholderAncestorPath = $placeholder.SubString(0, $placeholderLastIndexOfSlash)
#save the new placeholder
#but we need the p:after on the old "columns" component
# $col.Placeholder = $placeholderAncestorPath;
# Set-Rendering -Item $_ -Instance $col -FinalLayout;
#delete old rendering
#missing
}
}
}
}
}
| |
We created a support ticket with Sitecore and got some context on this.
Now the course is available on Sitecore learning and here is the link.
https://shop.learning.sitecore.com/products/bb21d39f-8a39-d1
And this course will also give you an attempt of Sitecore 10 certification. Here are the details.
Development with Sitecore 9 eLearning Collection Development with
Sitecore 10 eLearning Collection System Administration with Sitecore
10 eLearning Collection 1 voucher to take the Sitecore 10 .NET
Developer Certification Exam Sitecore 10 .NET Developer Certification
Exam Study Guide Note: The content and exam apply to developing for
both Sitecore Experience Manager (XM) and Sitecore Experience Platform
(XP)
You need to log in with your Sitecore credentials. If you don't have then you need to create an account.
| How to check the course material for Sitecore 10 Certification with New Sitecore Learning Portal
When I go to the below link on the Sitecore website, it shows the links to all the Sitecore certifications.
https://www.sitecore.com/knowledge-center/getting-started/training
But when I click on Sitecore 10 .NET Developer link, it redirects me to a page that requires a login.
My question is, do we need to login to see the content of the course before purchasing? If someone doesn't have login credentials then how they can see the course material?
Also previously I looked into this course and it comes up with the Sitecore 10 course material but now this is also not working.
https://learning.sitecore.com/pathway/sitecore-developer-bundle
Can someone suggest, if Sitecore has new links for Sitecore 10 course material?
Thanks
| |
Seems Symantec was causing the problem. I have stopped it by executing smc -stop in the Run dialog.
| Unable to install Helix example for Asp.Net Core - MsBuild timeout out while trying to get project to project references
I'm trying to setup the helix example for asp.net core rendering following this article.
It's not going past step 12 and shows this error.
MsBuild timeout out while trying to get project to project references.
The command 'powershell -Command $ErrorActionPreference = 'Stop';
$ProgressPreference = 'SilentlyContinue'; nuget restore -Verbosity
quiet' returned a non-zero code: 1
ERROR: Service 'solution' failed to
build : Build failed
I have also added "dns":["8.8.8.8"] to the Docker Engine configuration.
| |
The problem is mixing and matching SSR and SSG between components and pages. If your page is SSG, you must set your components to SSG also, to use SSR on your component, your page must be SSR.
Full disclosure, we worked together on Sitecore Slack to get the answer:
A better way to do this would be to use an api call to a function on the component, no instead of relying on the Next.js framework to call the getServerSideProps, the function is called when the main component is generated. Here is an update of your code as an example:
import {
constants,
GetServerSideComponentProps,
useComponentProps
} from '@sitecore-jss/sitecore-jss-nextjs';
import { GraphQLClient } from '@lib/graphql-client';
import config from '@temp/config';
const SearchResults = ({ fields, rendering }) => {
const externalData = getSearchData();
console.log("Search Result external data")
console.dir(externalData); <-- this should now contain data
// use externalData in your return
return (
<section>
[...redacted for clarity]
</section>
);
}
const getSearchData = () => {
if (process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED) {
return null;
}
const client = GraphQLClient(
`${config.sitecoreApiHost}/api/Search?sc_apikey=${config.sitecoreApiKey}`
);
return client;
}
export { SearchResults };
Notice that I have replaced the getServerSideProps function with getSearchData, and this function is called directly from your SearchResults component.
This will generate the results.
To take this further and have results created on the client side, you can also create a button that makes the call and dynamically updates the props on the component via ajax, this would be a way to add faceting or filtering to the main set of search results too.
| SSR Component Level Data fetching in JSS?
In a Headless Sitecore site I'm doing the front-end on, I'm trying to implement search. It's a JSS/Next.js based front end on top of the Sitecore back end. We've got:
JSS 20, Next 12.2, Sitecore 10.2
Optimized for SSG/ISR
A GraphQL API to get results to display.
A SearchResults component which is responsible for rendering results.
I'm trying to implement the component level data fetching approach outlined in the sitecore docs, but I guess I'm missing something. The getServerSideProps function exported from the component simply isn't called. Here's the relevant structure of my SearchResults component:
import {
constants,
GetServerSideComponentProps,
useComponentProps
} from '@sitecore-jss/sitecore-jss-nextjs';
import { GraphQLClient } from '@lib/graphql-client';
import config from '@temp/config';
const SearchResults = ({ fields, rendering }) => {
const externalData = useComponentProps(rendering?.uid);
console.log("Search Result external data")
console.dir(externalData); <-- this is always `undefined`
return (
<section>
[...redacted for clarity]
</section>
);
}
export const getServerSideProps = (rendering, layoutData) => {
console.log("SERVER SIDE PROPS!") // <-- This never gets called
if (process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED) {
return null;
}
const client = GraphQLClient(
`${config.sitecoreApiHost}/api/Search?sc_apikey=${config.sitecoreApiKey}`
);
return client;
}
export { SearchResults };
The doc linked above makes mention of the ComponentPropsService finding the component to call the getServerSideProps function:
The ComponentPropsService traverses the layout service data and looks at all the renderings. To find the components that require data fetching, the service spies on the component using the rendering.componentName against the list of component registrations in the src/temp/componentFactory file.
The SearchResults component is definitely defined in the src/temp/componentFactory file, but I must be missing something. That function, getServerSideProps, simply never gets called. If I'm supposed to somehow register the component with the ComponentPropsService so it knows about it and can call that function, it's not clear to me how to do that. Am I even on the right track?
| |
If you want to achieve a clear separation of concerns and delegate the Publishing responsibility to another CM instance then I would recommend to configure a Content Publishing (CP) service that can be installed as an Azure Application Service in addition to your existing CM instance to offload it.
CP service acts as a replacement for the Sitecore publishing methods that are part of the Content Management role and increases publishing throughput, reduces the amount of time spent publishing large volumes of items, and offers greater data consistency and reliability.
Please visit the Publishing Service download page for documentation about setup and configuration, and also check the CP compatibility table with your Sitecore version here.
For development needs you can simply run the Publishing role as a console application.
| How to configure/Install Multiple Sitecore CM instances(Authoring and Publishing) in Azure Web App?
We have installed Sitecore(9.0.1) instance in Azure Web App , we often facing Sitecore CM slowness as number users are more or number input requests are more and we have decide to go with multiple CM server one is for Authoring and Other one for Publishing. By scaling CM instance we may reduce the traffic.
Please suggest how can we setup multiple CM instances in Azure Web App?
| |
This issue is less about SPE and more how PowerShell is designed. Creating proxy functions can be helpful when the developer wants to insert additional steps such as logging. The easiest thing to do in your case is to kill the session used in the ISE; a recycle of the app pool will do this for the default ISE session.
There may be ways to restore the function without doing this but not something often encountered so not worth trying to fix it beyond the steps I described.
| Overwritten Sitecore Powershell Default Module Get-Rendering, How to recover the script block
I was creating custom functions using Sitecore Powershell script. I accidentally gave the custom function a name similar to the Sitecore function (say Get-Rendering). The default function script block was now overridden with my custom function. Now when I call the default Sitecore function, my custom function code is getting executed.
Please help me with details how to restore the script block for the Default Get-Rendering function.
| |
Stopping IIS worked for me.
These are the steps I had to do before following the instructions here:
https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-aspnetcore
#1 - run smc -stop in Run dialog to stop Symantec.
#2 - Then stop IIS in powershell with iisreset /stop.
#3 - Start Docker and uncheck Use Docker Compose V2 in Settings. Apply the changes & Restart Docker.
| How to create containers for Helix example
I'm trying to setup the code solution & the Sitecore instance in docker for a helix example, following this article.
https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-aspnetcore
After running the docker-compose up -d, it looks like it downloaded the images. I can see them in the Docker. But there are no containers.
I would like to see the Sitecore instance and the website to learn Headless development using ASP.NET Core Rendering SDK.
Should I manually create containers? Did the docker-compose step not run correctly?
How do I proceed from here.
docker-compose up -d status:
UPDATE:
I have unchecked "User Docker Compose V2" and then ran again.
It now fails with this error:
ERROR: for traefik Cannot start service traefik: failed to create
endpoint basic-company-aspnetcore_traefik_1 on network
basic-company-aspnetcore_default: failed during hnsCallRawResponse:
hnsCall failed in Win32: The process cannot access the file because it
is being used by another process. (0x20) ERROR: Encountered errors
while bringing up the project.
| |
Both roles are still required in non-development environments. As per Sitecore FAQ on this page:
With Sitecore Headless Development, you run the following instances:
A Content Delivery (CD) instance carrying less load, because it no longer handles the presentation layer. The CD instance still handles tracking, Sitecore Layout Service requests, GraphQL queries, personalization, and so on.
A lightweight rendering host that handles the presentation layer.
The NextJS Getting Started template contains all roles, but it is possible that you used sitecore-xp0 topology which is suitable for local development setup and does not create a CD container. Topologies sitecore-xm1 and sitecore-xp1 do have a CD container in their docker-compose.yml files.
| Is Sitecore CD role needed in headless setup with Rendering Host?
Looking on the Sitecore Headless Development conceptual overview, it does not really clear if Rendering Host is supposed to replace CD or both roles are still needed.
Sitecore NextJS Getting Started template generates sample solution with CM and Rendering roles only. But that might be just a local development setup. Are there any recomendations for the PROD configuration?
| |
I think this is what you are looking for. https://sitecore.namics.com/custom-solr-indexes-and-config-sets-in-sitecore-docker-containers/
| Docker Solr - set facet limit using solrconfig.xml
I am running Sitecore 10.2 in Docker. I have a custom index and need 100 facets from search result. I found a solution in Solr documentation. It suggest to raise a limit by changing solrconfig.xml. Got one more article taking about its solution:
Facet query returning 100 items max
Any idea how to set a facet limit in a Docker?
| |
Sitecore PowerShell Remoting (SPE Remoting) is broken up into two parts.
Part 1: Remoting web services installed in the CM/Standalone instance
These services are distributed with the packages provided for SPE but do require patches to enable/configure the services. For example, the "remoting" endpoint is disabled by default.
Part 2: Windows PowerShell module
The module is something that would be installed on a developer workstation, CI/CD server, or container and is the same environment where the script is executed.
So back to your question.
Import-Module -Name SPE is contained with a script running outside of Sitecore.
The connection URI is the location of your running instance of Sitecore (e.g. https://demo.dev.local).
The SPE module includes commands like Invoke-RemoteScript in which you embed the script to be executed inside a Sitecore context.
| Sitecore PowerShell Remoting: how to
Environment details: Sitecore 10 Azure PAAS hosting
I am trying to automate a few things in an already running Sitecore set-up.
For that, I wanted to utilize Sitecore Powershell remoting.
I have gone through different blogs and videos. Still, I have a few questions:
Almost all sample scripts start with Import-Module -Name SPE such as here.
So, from wherever this script has to be executed, the SPE module should be accessible.
So, I can conclude that this script will be present in Sitecore.
Is my understanding correct?
But then why do we need to provide the Connection URI, as mentioned here, if the script is being executed on the Sitecore instance?
If the script is being executed outside, how Sitecore is identifying the methods being exposed, as shown in the video
It would be of great help if the community can help me to understand how things work under the hood
| |
Confirm if you have set AllowedCorsOrigins in Config\Production\Sitecore.IdentityServer.Host.xml in the IdentityServer root folder.
<?xml version="1.0" encoding="utf-8"?>
<Settings>
<Sitecore>
<IdentityServer>
<Clients>
<DefaultClient>
...
<AllowedCorsOrigins>
<AllowedCorsOriginsGroup1>https://host1|http://host1</AllowedCorsOriginsGroup1>
<AllowedCorsOriginsGroup2>https://host2</AllowedCorsOriginsGroup2>
<AllowedCorsOriginsGroup3>https://host3</AllowedCorsOriginsGroup3>
</AllowedCorsOrigins>
...
| Identity Service - error on CM
On my local machine I have Sitecore 10.2, XP0. I have problem with Identity Service.
Upon entering the address: .cm / sitecore, he is redirected to the page <address>.cm/sitecore/login?Fbc=1. I should have been redirected to Sitecore Identity. My Sitecore Identity instance works fine, shows no error, works in the browser and the login process looks fine there. The certificates look correct. I have an error in CM logs:
12636 09:17:52 ERROR Unable to reach an external identity provider.
Exception: System.InvalidOperationException
Message: IDX20803: Unable to obtain configuration from: '[PII is hidden]'.
Source: Microsoft.IdentityModel.Protocols
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.<GetConfigurationAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationHandler.<ApplyResponseChallengeAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseCoreAsync>d__40.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<TeardownAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Owin.Middlewares.GlobalExceptionHandlerMiddleware.<Invoke>d__4.MoveNext()
Nested Exception
Exception: System.IO.IOException
Message: IDX20804: Unable to retrieve document from: '[PII is hidden]'.
Source: Microsoft.IdentityModel.Protocols
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.<GetDocumentAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.<GetAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.<GetConfigurationAsync>d__24.MoveNext()
Nested Exception
Exception: System.Net.Http.HttpRequestException
Message: Response status code does not indicate success: 503 (Service Unavailable).
Source: System.Net.Http
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.<GetDocumentAsync>d__8.MoveNext()
9840 09:17:52 ERROR Unable to reach an external identity provider.
Exception: System.InvalidOperationException
Message: IDX20803: Unable to obtain configuration from: '[PII is hidden]'.
Source: Microsoft.IdentityModel.Protocols
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.<GetConfigurationAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationHandler.<ApplyResponseChallengeAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseCoreAsync>d__40.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<TeardownAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Owin.Middlewares.GlobalExceptionHandlerMiddleware.<Invoke>d__4.MoveNext()
The configuration of Owin is basic (after installation) and looks correct - all addresses etc. are in my opinion as they should be. Has anyone encountered such a problem?
EDIT:
I added two files:
Sitecore.IdentitServer.Host.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Settings>
<Sitecore>
<IdentityServer>
<CertificateThumbprint>cert</CertificateThumbprint>
<CertificateStoreLocation>LocalMachine</CertificateStoreLocation>
<CertificateStoreName>My</CertificateStoreName>
<SitecoreMembershipOptions>
<ConnectionString>Data Source=localhost;Initial Catalog=ebok.locl_Core;User ID=securityuser;Password=pass</ConnectionString>
</SitecoreMembershipOptions>
<AccountOptions>
<PasswordRecoveryUrl>https://locl.sc/sitecore/login?rc=1</PasswordRecoveryUrl>
</AccountOptions>
<Clients>
<DefaultClient>
<AllowedCorsOrigins>
<AllowedCorsOriginsGroup1>https://locl.sc</AllowedCorsOriginsGroup1>
</AllowedCorsOrigins>
</DefaultClient>
<PasswordClient>
<ClientSecrets>
<ClientSecret1>secret</ClientSecret1>
</ClientSecrets>
</PasswordClient>
</Clients>
</IdentityServer>
</Sitecore>
</Settings>
And
Sitecore.Owin.Authencitaction.Identity.Server
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore role:require="Standalone or ContentManagement">
<sc.variable name="identityServerAuthority" value="https://locl.identityserver" />
<settings>
<!-- The URI of the IdentityServer provider. -->
<setting name="FederatedAuthentication.IdentityServer.Authority" value="$(identityServerAuthority)" />
<!-- The internal authority of SI Server. Leave it empty if it is the same as FederatedAuthentication.IdentityServer.Authority.
Example: http://sitecore.identity -->
<!--<setting name="FederatedAuthentication.IdentityServer.InternalAuthority" value="" />-->
<!-- The client identifier on the IdentityServer. -->
<setting name="FederatedAuthentication.IdentityServer.ClientId" value="Sitecore" />
<!-- Fill the FederatedAuthentication.IdentityServer.CallbackAuthority setting if you need another host to receive callbacks from IdentityServer. It is useful for reverse proxy configuration. -->
<!--<setting name="FederatedAuthentication.IdentityServer.CallbackAuthority" value="http://proxy" />-->
<!-- The client identifier for the Resource Owner Password flow on the IdentityServer. -->
<setting name="FederatedAuthentication.IdentityServer.ResourceOwnerClientId" value="SitecorePassword" />
<!-- Wheither HTTPS is required or not for the metadata address or authority -->
<setting name="FederatedAuthentication.IdentityServer.RequireHttpsMetadata" value="true" />
</settings>
<services>
<configurator type="Sitecore.Owin.Authentication.IdentityServer.ServicesConfigurator, Sitecore.Owin.Authentication.IdentityServer" />
</services>
<pipelines>
<owin.identityProviders>
<processor type="Sitecore.Owin.Authentication.IdentityServer.Pipelines.IdentityProviders.ConfigureIdentityServer, Sitecore.Owin.Authentication.IdentityServer" resolve="true" id="SitecoreIdentityServer">
<scopes hint="list">
<scope name="openid">openid</scope>
<scope name="sitecore.profile">sitecore.profile</scope>
</scopes>
</processor>
</owin.identityProviders>
<owin.initialize>
<processor type="Sitecore.Owin.Authentication.IdentityServer.Pipelines.Initialize.InterceptLegacyShellLoginPage, Sitecore.Owin.Authentication.IdentityServer" patch:before="processor[@method='Authenticate']" resolve="true">
<legacyShellLoginPage>/sitecore/login</legacyShellLoginPage>
</processor>
<processor type="Sitecore.Owin.Authentication.IdentityServer.Pipelines.Initialize.JwtBearerAuthentication, Sitecore.Owin.Authentication.IdentityServer" patch:before="processor[@method='Authenticate']" resolve="true">
<identityProviderName>SitecoreIdentityServer</identityProviderName>
<audiences hint="raw:AddAudience">
<audience value="$(identityServerAuthority)/resources" />
</audiences>
<issuers hint="list">
<issuer>$(identityServerAuthority)</issuer>
</issuers>
</processor>
<processor type="Sitecore.Owin.Authentication.IdentityServer.Pipelines.Initialize.LogoutEndpoint, Sitecore.Owin.Authentication.IdentityServer" resolve="true" patch:before="processor[@method='Authenticate']" />
</owin.initialize>
</pipelines>
<federatedAuthentication>
<identityProvidersPerSites>
<mapEntry name="sites with the core and unspecified database">
<identityProviders hint="list:AddIdentityProvider">
<identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='SitecoreIdentityServer']" id="SitecoreIdentityServer" />
</identityProviders>
</mapEntry>
<!-- An example that maps a sub-provider of the Identity Server to the sites that are not mapped to the SitecoreIdentityServer. -->
<!--
<mapEntry name="all sites">
<identityProviders hint="list:AddIdentityProvider">
<identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='SitecoreIdentityServer/IdS4-AzureAd']" />
</identityProviders>
</mapEntry>
-->
</identityProvidersPerSites>
<identityProviders>
<identityProvider id="SitecoreIdentityServer" type="Sitecore.Owin.Authentication.IdentityServer.IdentityServerProvider, Sitecore.Owin.Authentication.IdentityServer" resolve="true">
<caption>Go to login</caption>
<domain>sitecore</domain>
<enabled>true</enabled>
<triggerExternalSignOut>true</triggerExternalSignOut>
<transformations hint="list:AddTransformation">
<transformation name="apply additional claims" type="Sitecore.Owin.Authentication.IdentityServer.Transformations.ApplyAdditionalClaims, Sitecore.Owin.Authentication.IdentityServer" resolve="true" />
<transformation name="name to long name" type="Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication">
<sources hint="raw:AddSource">
<claim name="name" />
</sources>
<targets hint="raw:AddTarget">
<claim name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" />
</targets>
<keepSource>true</keepSource>
</transformation>
<transformation name="role to long role" type="Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication">
<sources hint="raw:AddSource">
<claim name="role" />
</sources>
<targets hint="raw:AddTarget">
<claim name="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" />
</targets>
<keepSource>false</keepSource>
</transformation>
<transformation name="set ShadowUser" type="Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication">
<sources hint="raw:AddSource">
<claim name="http://schemas.microsoft.com/identity/claims/identityprovider" value="local" />
</sources>
<targets hint="raw:AddTarget">
<claim name="http://www.sitecore.net/identity/claims/shadowuser" value="true" />
</targets>
<keepSource>true</keepSource>
</transformation>
<!-- owin.cookieAuthentication.signIn pipeline uses http://www.sitecore.net/identity/claims/cookieExp claim to override authentication cookie expiration.
'exp' claim value can be configured on Sitecore Identity server on the client configuration by IdentityTokenLifetimeInSeconds setting.
Note: Claim value is Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z -->
<transformation name="use exp claim for authentication cookie expiration" type="Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication">
<sources hint="raw:AddSource">
<claim name="exp" />
</sources>
<targets hint="raw:AddTarget">
<claim name="http://www.sitecore.net/identity/claims/cookieExp" />
</targets>
<keepSource>true</keepSource>
</transformation>
<transformation name="remove local role claims" type="Sitecore.Owin.Authentication.IdentityServer.Transformations.RemoveLocalRoles, Sitecore.Owin.Authentication.IdentityServer" />
<transformation name="adjust NameIdentifier claim" type="Sitecore.Owin.Authentication.IdentityServer.Transformations.AdjustNameIdentifierClaim, Sitecore.Owin.Authentication.IdentityServer" resolve="true" />
</transformations>
</identityProvider>
<!-- An example of how to add an identity provider as a sub-provider of the Identity Server.
The 'name' property must be in the following format: SitecoreIdentityServer/[AuthenticationScheme], where the 'AuthenticationScheme' equals the
authentication scheme of an external identity provider that is configured on the Identity Server.
Notes:
1. The 'TriggerExternalSignOut' and 'Transformations' properties are inherited from the the Identity Server provider node and can not be overridden.
2. To use a sub-provider, the 'Enabled' property of the Identity Server provider must be set to 'Enabled'. -->
<!--
<identityProvider id="SitecoreIdentityServer/IdS4-AzureAd" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
<param desc="name">$(id)</param>
<param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
<caption>Log in with Sitecore Identity: Azure AD</caption>
<icon>/sitecore/shell/themes/standard/Images/24x24/msazure.png</icon>
<domain>sitecore</domain>
</identityProvider>
-->
</identityProviders>
<propertyInitializer>
<maps>
<map name="set Email" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
<data hint="raw:AddData">
<source name="email" />
<target name="Email" />
</data>
</map>
<map name="set FullName" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
<data hint="raw:AddData">
<source name="name" />
<target name="FullName" />
</data>
</map>
<map name="set IsAdministrator" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
<data hint="raw:AddData">
<source name="http://www.sitecore.net/identity/claims/isAdmin" value="true" />
<target name="IsAdministrator" value="true" />
</data>
</map>
</maps>
</propertyInitializer>
</federatedAuthentication>
<sites>
<site name="shell" set:loginPage="$(loginPath)shell/SitecoreIdentityServer" />
<site name="admin" set:loginPage="$(loginPath)admin/SitecoreIdentityServer" />
</sites>
</sitecore>
</configuration>
| |
I resolved this issue, it was related to File Name Length Error in TDS.
By default Microsoft has a character limitation for file paths. The folder and file name must remain under 260 characters. If you’re familiar with Twitter, 260 characters seems like a breeze. However, most projects easily hit that limit. For this we created a work around in TDS.
The File Alias function in TDS allows you to shorten the file path to fit in the requirements that Microsoft set. You’ll probably see the following error if trying to sync items into a TDS project tree that already exceeds the path length:
“The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters”.
For more information you can read below article
https://www.teamdevelopmentforsitecore.com/Blog/file-length-error-tds
| Could not find a part of the path in TDS
I am trying to sync items in TDS during sync some items I am getting this error.
Could not find a part of the path
'D:\Projects\WebsiteProject\TDS\Intranet\TDS.Master.Templates\sitecore\templates\User Defined\Folder1\Folder2\Folder3\Example Template\Example Template Section\title.item'.
Please see the output window for more details. (SitecoreSyncException):
at HedgehogDevelopment.SitecoreProject.VSIP.Controls.SyncWithSitecore.RunSyncForProject(SitecoreProjectNode project)
at HedgehogDevelopment.SitecoreProject.VSIP.Controls.SyncWithSitecore.RunSync()
Inner Exception Details:
Exception Could not find a part of the path 'D:\Projects\WebsiteProject\TDS\Intranet\TDS.Master.Templates\sitecore\templates\User Defined\Folder1\Folder2\Folder3\Example Template\Example Template Section\title.item'. (DirectoryNotFoundException):
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.File.InternalWriteAllBytes(String path, Byte[] bytes, Boolean checkHost)
at System.IO.File.WriteAllBytes(String path, Byte[] bytes)
at HedgehogDevelopment.SitecoreProject.VSIP.SitecoreItemNode.RefreshSitecoreInfo(String sitecoreItemPath)
at HedgehogDevelopment.SitecoreProject.VSIP.SitecoreProjectNode.CreateSitecoreItemNode(String localItemPath, String sitecoreIcon, HierarchyNode parent)
at HedgehogDevelopment.SitecoreProject.VSIP.Controls.SitecoreSyncTreeNode.DoSyncAction(Boolean& applyToAll)
at HedgehogDevelopment.SitecoreProject.VSIP.Controls.SyncWithSitecore.RunSyncForProject(SitecoreProjectNode project)
Exception An exception occured while updating the sitecore item \sitecore\templates\User Defined\Folder1\Folder2\Folder3\Example Template\Example Template Section\title.item
My Sitecore version is 9.3.
| |
There is a setting in the Sitecore.Owin.Authentication.IdentityServer.config file. You can find this file on the following location: \App_Config\Sitecore\Owin.Authentication.IdentityServer\.
Search for the following setting:
<triggerExternalSignOut>true</triggerExternalSignOut>
If you change that to false it should only log you out of Sitecore and not Azure AD.
| Signing out of Sitecore with Azure AD
We are working on an upgrade from Sitecore 8.2 to 10.2 with an Azure AD sign-in/sign-out component. Right now, when a user is logged in with Azure AD in Sitecore and clicks the logout button it is logging them out of all of the Azure AD accounts. Is there a way to prevent this and only log them out of Sitecore?
I can't find any exact documentation describing how to do this.
| |
There is a query string parameter fld that should be already present out of the box:
But as you need to have 2 field, I suggest you to
Override Class and Assebly fields for your /sitecore/system/Field types/Simple Types/Rich Text item.
public class YourRTEEditor : RichText
/// <summary>Gets or sets the field ID.</summary>
/// <value>The field ID.</value>
public string FieldID
{
get
{
return this.GetViewStateString(ExtensionMethods.nameof(() => FieldID));
}
set
{
Assert.ArgumentNotNull((object)value, ExtensionMethods.nameof(() => value));
this.SetViewStateString(ExtensionMethods.nameof(() => FieldID), value);
}
}
Change logic and pass 2 fields there instead of one
I did something similar with passing 2 parameters for datasouce for the TinyMCE module, you can look at it as a reference.
| Sitecore Custom RTE with custom aspx page- Need to pass current filed id as query string
We am developing a custom HTML editor that will show the HTML editor with third JS library files.
In core DB We have added a menu commend (copy of Existing rich text edit button and updated our command name rich:editor) that comes just top of Rich text field.
Here we are able to pass current Items with ($TargetId) but we also need current filed ID so that we can use current selected filed in dialog box code to save custom html to respective filed.
Here we want to send the two filed id's on click of rich text menu command button one for Current filed and second another filed Id that also belong to current Sitecore selected item.
FYI - Inside Run method of Command we are able to get Current Item but here We want some additional filed as well.
Any kind of help will be helpful for us.
| |
No, you do not need to add these fields to the Solr Managed Schema. This is because these fields in the content database are listed as strings.
There is a dynamic field setting in the Managed Schema that will classify these fields as "strings".
As such, and as listed in the blog post, these fields will automatically appear in the document for the returned items as such:
You will still want to make sure that the proper configuration on the CD's are created for your specific Sitecore site. Notice in the blog post that the Sitecore.Publishing.Service.ContentAvailability.config out of the box only contains a configuration for the "website" site, which is Sitecore's default site.
You'll want to make sure you include other sites, as appropriate here.
Edit: The _IsAvailable field is setup as a virtual field in the search query and computed at Runtime. There's a great answer here that explains the difference between Computed Fields and Virtual Fields. You don't need to add it to the schema because the value is not stored in the index itself.
Virtual Fields have draw backs as they can cause queries to be expensive and slow depending on what you are doing.
| Do we need to add Publishing Service Content Availability Solr Fields to the Managed Schema?
We have configured publishing service in our environment and we came across with below post. Should we manually add the fields in SOLR managed schema?
isAvailable
versionsunrisedate
versionsunsetdate
publishablefrom
publishableto
https://blog.senktas.net/2019/08/10/deep-dive-to-content-availability-feature-in-publishing-service/
| |
As I learned during the Sitecore 10 development, there are two kinds of projects we use while Developing with the ASP.NET Core Rendering SDK. They are as follows.
RenderingHost project: It is the primary project and is considered the startup project which will run when debugging in Visual Studio. The RenderingHost project is also where you’ll be creating models and views necessary to support custom components. The Startup.cs class within the Rendering project is also where these views can be registered for use within Sitecore.
Platform project: Corresponds to the Content Management container and contains the code and configuration for that part of the Sitecore platform. To deploy any code changes to the configuration, assemblies, or content, this project will need to be published from Visual Studio. If changes are made to the Platform project, debugging is an optional, but recommended step. To debug the Platform project, you will need to attach it to the w3wp process within the Content Delivery container.
Now the architecture you are following is a Helix based architecture and you can see feature and foundation folders.
I hope I can answer your questions.
As mentioned in the RenderingHost project, it contains a startup.cs file that is used to register the views. So you can see in the BasicCompany.Project.BasicCompany.Rendering, they are using all the features *.rendering projects under the Dependencies
And registering them into the Startup.cs file using this statement.
// Register the Sitecore Rendering Engine services.
services.AddSitecoreRenderingEngine(options =>
{
//Register your components here
options
.AddFeatureBasicContent()
.AddFeatureNavigation()
.AddFeatureProducts()
.AddFeatureServices()
.AddDefaultPartialView("_ComponentNotFound");
})
So the summary is that Model-bound components supported by a model and view must be registered within the Startup.cs class to be used in the rendering host. Thats' why they are being used as Dependencies under the BasicCompany.Project.BasicCompany.Rendering project and all the Platform projects are associated with their feature project. I think you need to use the same pattern as you get from the sample project.
I hope this makes sense.
| Visual Studio Project purpose & templates for ASP.NET Rendering SDK application
This is how the Helix example is structured and I'm trying to understand it.
The *.rendering in the Project layer looks like an ASP.NET Core template but the *.rendering projects in the Feature layer look like Class Library/Console App. Why is it different?
Please let me know what should be the template for creating the *.rendering & *.platform projects (e.g. Console app, MVC app, .Net core app, class library etc).
I understand the purpose of Feature, Foundation & Project layers. But for developing a Headless architechture with .Net core Rendering SDK, I'm unable to understand what should be in the *.platform & what should be in *.rendering.
| |
If you will specify SitecoreFieldSettings.RichTextRaw, Sitecore will only call Render Field pipeline when rendering this field in edit mode. This means links within the field are not processed and converted when rendered on the front end. Links will have the default .ashx extension. To have links within your Rich Text fields to render with user-friendly URLs (not with the .ashx extension), the setting Media.RequestExtension needs to be blank (which you already not have) and your Rich Text fields must not have SitecoreFieldSettings.RichTextRaw.
[SitecoreField(I_HasPageContentConstants.BodyFieldName)]
string Body {get; set;}
config setting -
<!-- MEDIA - REQUEST EXTENSION
The extension to use in media request URLs.
If the value is not set, the Extension field of the individual media items will be used (ie. JPG, GIF, etc.)
Default value: "ashx"
-->
<setting name="Media.RequestExtension" value="" />
| Glassmapper and Media.RequestExtension Not Working Together
I've got a Rich Text Field and using glass mapper to render the body field
[SitecoreField(I_HasPageContentConstants.BodyFieldName, Setting = SitecoreFieldSettings.RichTextRaw)]
string Body {get; set;}
@Html.Glass().Editable(x => x.Body)
my rich text content is rendered however media that is embedded in the RTE content renders out with the .ashx extension.
Glassmapper doesn't seem to be using the Media.RequestExtension setting.
<!-- MEDIA - REQUEST EXTENSION
The extension to use in media request URLs.
If the value is not set, the Extension field of the individual media items will be used (ie. JPG, GIF, etc.)
Default value: "ashx"
-->
<setting name="Media.RequestExtension" value="" />
I've tested rendering the field using Sitecore field rendering such as (below) and it works as expected.
@Html.Sitecore().Field("Body")
Is there a way I can get glass mapper to render RTE content and correctly render linked media with the Media.RequestExtension setting?
using the following glass package
<package id="Glass.Mapper.Sc.101" version="5.8.180" targetFramework="net48" />
| |
I have come to the conclusion that the best way to do this is how I outlined in my original question, which is to override the default ConvertPageDataToPageViewEvent pipeline. However, that approach has limitations and drawbacks.
A better approach would be to register a custom event which allows for any necessary customization. That approach is outlined in a related question/answer.
| How to store full URLs in page view events instead of just the path?
I have a case where I need page view events to store full URLs in the Url property instead of just the paths.
For example, if I explore the Interactions table, inside the Events column, PageViewEvents have the following data:
{"@odata.type":"#Sitecore.XConnect.Collection.Model.PageViewEvent","CustomValues":[],"DefinitionId":"9326cb1e-cec8-48f2-9a3e-91c7dbb2166c","ItemId":"xxxxxxx","Id":"xxxxxxx","Timestamp":"2022-07-08T20:23:06.1411643Z","ItemLanguage":"en","ItemVersion":1,"Url":"/-/media/project/client/image.jpg","SitecoreRenderingDevice":{"Id":"fe5d7fdf-89c0-4d99-9aa3-b5fbd009c9f3","Name":"Default"}}
However, I would like the full URL to be stored in the Url prop; not just the path.
My analysis so far has shown that the Sitecore.XConnect.Collection.Model.PageViewEvent class has a public string Url { get; set; } property. My assumption is that the best practice would be to trigger the page view event manually and/or create a custom page view event model, and populate the Url property with the value that I want. However, I don't want duplicate page view events (1 custom and 1 default).
Otherwise, it seems I would have to override the default behavior in Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageDataToPageViewEvent. As an example:
private PageViewEvent CreatePageViewEvent(PageData pageData)
{
// Note that there is so access to Sitecore context here
PageViewEvent pageViewEvent = new PageViewEvent(pageData.DateTime, pageData.Item.Id, pageData.Item.Version, pageData.Item.Language);
pageViewEvent.Duration = TimeSpan.FromMilliseconds((double)pageData.Duration);
// Populate the full URL here instead, or in PageData before we even get here
pageViewEvent.Url = pageData.Url.ToString();
// Or, create a new entry in CustomValues (though Sitecore says not to do this)
pageViewEvent.CustomValues.Add("FullUrl", "https://www.site.com/-/media/project/client/image.jpg");
...
}
As well as the associated config:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<convertToXConnectEvent>
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageDataToPageViewEvent, Sitecore.Analytics.XConnect">
<patch:attribute name="type" value="Client.Foundation.DataExchange.Pipelines.ConvertToXConnectEventPipeline.ConvertPageDataToPageViewEvent, Client.Foundation.DataExchange" />
</processor>
</convertToXConnectEvent>
</pipelines>
</sitecore>
</configuration>
The above code does work, however, it modifies all page view events going forward which may not always be applicable. What approach would you recommend?
| |
I faced the same issue recently. 2 solutions I can suggest -
Disable TLS 1.3 over TCP for xconnect. Rerun the installation script or disable this as soon as the xconnect bindings are setup by script during installation. for reference - https://sandeeppote.com/2021/11/14/step-by-step-guide-to-install-sitecore-xp-10-2-using-sif-on-windows-11/
After applying the above changes still I faced the issue so I uninstall WAC. After this, I started the installation again and it was successful.
| Sitecore 10.1.1 installation issue - failed to start service 'Sitecore xconnect search indexer'
I have failed to install Sitecore 10.1.1 on my local.
I've tried giving full permission to users.
The license I believe is okay as well.
There are the logs from the event viewer. Did anyone encounter this issue before?
Application: Sitecore.XConnectSearchIndexer.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
at .( , String )
at ..ctor(String )
at ..ctor(String )
at Sitecore.XConnect.Configuration.Extensions.InitializeLicenseCheck(IServiceCollection collection, String licenseFileOrXml)
at Sitecore.XConnect.Configuration.Extensions.UseXConnectServiceInitializationConfiguration(IServiceCollection collection, IConfiguration configuration, String[] configurationSectionNames, String initializationSectionName, Boolean validateConfiguration)
at Sitecore.XConnect.Search.Indexer.ServiceProviderFactory.GetDiServiceProvider(IConfiguration config, String modelDirectory)
at Sitecore.XConnect.Search.Indexer.IndexerHostDependencies..ctor(IConfigurationRoot config)
at Sitecore.XConnect.Search.Indexer.IndexerAppDomainHost.IndexerHostAppDomainBridge..ctor()
Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(System.String, System.String)
at Sitecore.XConnect.Search.Indexer.IndexerAppDomainHost.CreateAppDomainAndIndexer()
at Sitecore.XConnect.Search.Indexer.IndexerAppDomainHost.CreateAndStartIndexerInNewAppDomain()
at Sitecore.XConnect.Search.Indexer.IndexerAppDomainHost.Start()
at Sitecore.XConnect.Search.Indexer.Service.OnStart(System.String[])
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(System.Object)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.ServiceProcess.ServiceBase.Run(System.ServiceProcess.ServiceBase[])
at Sitecore.XConnect.Search.Indexer.Program.RunAsService(Microsoft.Extensions.Configuration.IConfigurationRoot)
at Sitecore.XConnect.Search.Indexer.Program.InitializeConfigurationAndRun(System.Action`1<Microsoft.Extensions.Configuration.IConfigurationRoot>)
at Sitecore.XConnect.Search.Indexer.Program.Main(System.String[])
| |
#2 case is correct. Child items will not publish if they are not in the final workflow, that's how Sitecore workflow works.
Let's suppose you have some child items and don't want to publish them what will you do if case #1 will happen, it will publish those unwanted items as well.
But if you want to publish a child with a parent then you would need to write a custom approval action that checks all related items when the main item is approved and sets the workflow of the related items (or subitems) to the approved state.
Here's one example of how this could be done: http://sitecorepromenade.blogspot.com/2015/10/workflow-with-auto-publish-related-items.html
| Does sitecore child item in draft state gets published when deep=1 is set on Parent
I've a case where there is a sitecore parent item is in a workflow state and in the final workflow state, parameters are set to deep=1&related=1&alllanguages=1. The scenario here is that the child items are also in any sitecore state (Except final workflow state). When Parent item gets published, the Child items do not.
I discussed this problem with few sitecore experts and their opinion is different regarding this behaviour. Some says this should not be the case, despite of the child item's current state it should publish them and some says this is exactly sitecore should behave (I support this side :)).
Can some one please help me to end this discussion with facts.
Thanks,
Arun
| |
In order to fix this error, you should move to Windows containers.
Right-click the Docker Whale icon
Choose "Switch to Windows containers..."
Hit "Switch". If the process fails, let Docker Desktop restart itself and retry. The reason why Docker may crash, is that it has active containers running in the background. Don't worry about it and just retry.
Wait for the process to finish. When the Docker Desktop is green again, in the lower-left corner, you're good to go.
Try this, hope this solved your issue.
| ERROR: Service 'dotnetsdk' failed to build : Build failed
I am getting failed to register layer: Error processing tar file(exit status 1): link /Files/Program Files/common files/Microsoft Shared/Ink/en-US/micaut.dll.mui /Files/Program Files (x86)/common files/Microsoft Shared/ink/en-US/micaut.dll.mui: no such file or directory ERROR: Service 'dotnetsdk' failed to build : Build failed, when running up.ps1 in step 7 of Create the MyProject solution in the Sitecore 10 Getting Started Template.
Env
Powershell running in admin, version 5.1
.Net Framework version 4.8
.Net core SDK version 3.1
Docker Desktop 4.11
Console output
PS D:\Lencia\MyProject> .\up.ps1
Building containers...
solr uses an image, skipping
mssql uses an image, skipping
traefik uses an image, skipping
Building dotnetsdk
[+] Building 825.2s (4/9)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 1.98kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 1.2s
=> ERROR [1/6] FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019@sha256:2d315059f5704a09c75dc45e12352e6a53ad6a208fdd5e79c4005dcdac1ac1de 823.9s
=> => resolve mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019@sha256:2d315059f5704a09c75dc45e12352e6a53ad6a208fdd5e79c4005dcdac1ac1de 0.0s
=> => sha256:49067b9f938ad8183436027e0cbb1b4becb6d1b7e75669cb6b3cab2218240004 11.08kB / 11.08kB 0.0s
=> => sha256:b111c3320c949bea81612bf4554f1b6592c2f504920b5bf57ba340a1d4d52c93 1.88GB / 1.88GB 654.1s
=> => sha256:2d315059f5704a09c75dc45e12352e6a53ad6a208fdd5e79c4005dcdac1ac1de 2.79kB / 2.79kB 0.0s
=> => sha256:7aca8de30754f19fe03ee4c21eed0762efb5e91bf684b0cc36cc92b2af13446d 794.88MB / 794.88MB 192.0s
=> => sha256:187da2dbc6618d05b13d2081df50cfa22914ddd6ff7b2c3e42fd3717038487c4 1.29kB / 1.29kB 0.1s
=> => sha256:eb5fc0ce360f49b58a93bee8f973f955c4566f60fe1f2b4642d9478f495c888a 930.71MB / 930.71MB 252.5s
=> => sha256:b283d0205c7122edc4f8364c15ceaa42aedd4111684e9e6ad55bcf070629ef47 1.29kB / 1.29kB 192.6s
=> => sha256:761cd75a4b44c045d4c93f18144d31a6803209432067e02c2bb46e0527d3fdbf 8.02MB / 8.02MB 195.5s
=> => sha256:50c2f63f30821afc04b2356e564875f0a5f97ab9a432c230fe2e14725ff0c88d 1.65GB / 1.65GB 627.7s
=> => sha256:0df54937d9b2ef12ef1a7055d4a6912fb85f8adde65284cd31251f7c6533caa2 619.55kB / 619.55kB 253.3s
=> => sha256:d77a88ab318d259831fe167bd0332cb25668f5503a25b60f3f8544bc040d8879 167.61MB / 167.61MB 326.0s
=> => sha256:16a57bb2ad223b843bd8aeb119680817b303b14d04f2e73971a36328da978942 1.30kB / 1.30kB 326.5s
=> => extracting sha256:b111c3320c949bea81612bf4554f1b6592c2f504920b5bf57ba340a1d4d52c93 129.2s
=> => extracting sha256:7aca8de30754f19fe03ee4c21eed0762efb5e91bf684b0cc36cc92b2af13446d 39.3s
------
> [1/6] FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019@sha256:2d315059f5704a09c75dc45e12352e6a53ad6a208fdd5e79c4005dcdac1ac1de:
------
failed to register layer: Error processing tar file(exit status 1): link /Files/Program Files/common files/Microsoft Shared/Ink/en-US/micaut.dll.mui /Files/Program Files (x86)/common files/Microsoft Shared/ink/en-US/micaut.dll.mui: no such file or directory
ERROR: Service 'dotnetsdk' failed to build : Build failed
D:\Lencia\MyProject\up.ps1 : Container build failed, see errors above.
At line:1 char:1
+ .\up.ps1
+ ~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,up.ps1
Do you have any ideas about this issue? Did I do any wrong?
Thank for your support!
| |
You should still have some access to the services in Azure - for my project running in Managed Cloud in containers (Kubernetes) I can use kubectl to show the logs. For debugging purposes I found this to be the fastest way.
But you can also use Kibana (open-source data visualization tool used to show the logs stored in ElasticSearch). Check https://doc.sitecore.com/xp/en/developers/102/managed-cloud/getting-started-with-managed-cloud-standard.html on how to access Kibana. I wrote a small part about it in my blog https://ggullentops.blogspot.com/2022/03/sitecore-managed-cloud-SXA-jss-nextjs.html :
Kibana
This might sound like a sunny Brazilian beach but it's actually the
place to find your logs - based on Elastic Search. You'll find the
information in the Sitecore docs, your url and login information in
the secrets and you're good to go.
If you are not used to this environment it can be a bit tricky to find what you are looking for. First of all: find the
navigation - and go to "Discover" in the "Analytics section. You
should get a lot of entries that might make no sense so you need to
start filtering. The servicename is a good place to start: those will
be like "sitecore-xm1-cm" and so on. The pod_name can also be useful
if you know it. Best way for me was start simple and check the results
to see which fields are available and can be used to filter further to
get the logs needed.
| Querying and viewing Sitecore logs in managed cloud
Currently upgrading to 10.2 and migrating to SC managed Cloud as part of this project. We are having a few issues after our first image deployment. I would like to view the SC logs. Its my understanding that the Sitecore logs are exported into Elastic Search. How do we access Elastic Search to view / query the logs?
| |
The appropriate pipeline in this case appears to be ProcessItem:
using Sitecore.Analytics;
using Sitecore;
using System;
using Sitecore.Analytics.Pipelines.ProcessItem;
using Sitecore.Diagnostics;
using Sitecore.Analytics.Data;
using System.Collections.Generic;
namespace Client.Project.Pipelines.ProcessItem
{
public class RegisterCustomPageEvents : ProcessItemProcessor
{
public override void Process(ProcessItemArgs args)
{
Assert.ArgumentNotNull((object)args, nameof(args));
foreach (TrackingField trackingParameter in (IEnumerable<TrackingField>)args.TrackingParameters)
TrackingFieldProcessor.ProcessEvents(args.Interaction, trackingParameter);
if (!Tracker.Enabled || Tracker.Current == null || !Tracker.Current.IsActive)
{
return;
}
FireCustomEvent(args);
}
private void FireCustomEvent(ProcessItemArgs args)
{
var myPageTemplateId = "{xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx}";
if (args.Item == null || Context.Item.TemplateID.ToString() != myPageTemplateId)
{
return;
}
var ev = Tracker.MarketingDefinitions.PageEvents[Guid.Parse("{xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx}")];
if (ev != null)
{
var pageData = new Sitecore.Analytics.Data.PageEventData(ev.Alias, ev.Id);
pageData.Text = "My custom event";
var fullUrl = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;
pageData.CustomValues.Add("Url", fullUrl);
pageData.CustomValues.Add("PageTemplateId", args.Item.TemplateID.ToString());
pageData.CustomValues.Add("ItemVersion", args.Item.Version.Number);
pageData.ItemId = args.Item.ID.ToGuid();
try
{
Tracker.Current.CurrentPage.Register(pageData);
}
catch (Exception ex)
{
Log.Error("Unable to fire custom event", ex, this);
}
}
}
}
}
Patch config:
<sitecore>
<pipelines>
<processItem>
<processor type="Client.Project.Pipelines.ProcessItem.RegisterCustomPageEvents, Client.Project" />
</processItem>
</pipelines>
</sitecore>
| Where to fire a custom XConnect event on page load?
I have a case where I want to fire a custom page event but only for a specific page template. This means that whichever pipeline I fire the event from, I need access to:
Current page's template ID OR the Sitecore Context Item by which the template ID can be derived
Tracker
Full URL of the request
At a high level, this is the code I am looking to fire:
using Sitecore;
using Sitecore.Pipelines.HttpRequest;
using System;
using Sitecore.Analytics;
namespace Client.Project.Pipelines.httpRequestBegin
{
public class FirePageEvents : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
if (Context.Item == null || Context.Item.TemplateID.ToString() != myPageTemplateID)
{
return;
}
if (!Tracker.Enabled || Tracker.Current == null || !Tracker.Current.IsActive)
{
return;
}
var ev = Tracker.MarketingDefinitions.PageEvents[Guid.Parse("{xxxxxxxxxxxxxxxx}")];
if (ev == null)
{
return;
}
var pageData = new Sitecore.Analytics.Data.PageEventData(ev.Alias, ev.Id);
pageData.Text = "Custom event which fires on page load";
pageData.ItemId = Context.Item.ID.ToGuid();
pageData.CustomValues.Add("PageTemplateId", Context.Item.TemplateID.ToString());
pageData.CustomValues.Add("Url", args.Request.Url.AbsoluteUri);
try
{
Tracker.Current.CurrentPage.Register(pageData);
}
catch(Exception ex)
{
// Handle
}
}
}
}
From which pipeline is the best place to trigger the custom page view event? This would certainly be project specific, but this requirement seems general enough to be useful to the community.
| |
While I don't recall what the exact solution was (though I don't believe it was due to config settings), I did post a working solution in this blog post. There is quite a bit of code involved, so I won't include it.
The key was this:
When I remove my custom processor from the patch config, everything begins working as normal again
Therefore, there was likely a defect in the code that was somehow preventing any interactions from being serialized.
| Interactions not saving to xdb when processing custom events?
In my SC 9.3 solution I have a custom page event that I am firing, converting, and wanting to store in xdb. When I debug the code:
I can see the events getting registered as expected
I can inspect the current interaction (via Tracker.Current.Interaction.ToVisitData()) and all information pertaining to my custom event appears as expected
I can see my custom converter running as expected and creating the custom event when I end the session (via Session.Abandon())
However, when I run this database query, I am not seeing any new interactions getting added whatsoever; not even the default ones such as PageViewEvents:
SELECT *
FROM [Project_Xdb.Collection.Shard0].[xdb_collection].[Interactions]
UNION
SELECT *
FROM [Project_Xdb.Collection.Shard1].[xdb_collection].[Interactions]
ORDER BY Created DESC
I also don't see any data in my Interactions_Staging databases.
When I remove my custom processor from the patch config, everything begins working as normal again, and interactions are saved in xdb once the session is abandoned (except for my custom event, of course).
Here is how I registered the custom converter:
<convertToXConnectEvent>
<processor patch:after="processor[@type='Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToGoal, Sitecore.Analytics.XConnect']" type="Client.Project.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToMyCustomEvent, Client.Project"/>
</convertToXConnectEvent>
The showconfig.aspx appears as follows:
<convertToXConnectEvent patch:source="Sitecore.Analytics.Tracking.config">
<processor type="Sitecore.EmailCampaign.Cd.Pipelines.ConvertToXConnectEvent.ConvertPageEventDataToEmailEvent, Sitecore.EmailCampaign.Cd" resolve="true" patch:source="Sitecore.EmailExperience.ContentDelivery.config"/>
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageDataToPageViewEvent, Sitecore.Analytics.XConnect"/>
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertOutcomeDataToOutcome, Sitecore.Analytics.XConnect"/>
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToCampaignEvent, Sitecore.Analytics.XConnect"/>
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToDownloadEvent, Sitecore.Analytics.XConnect"/>
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToSearchEvent, Sitecore.Analytics.XConnect"/>
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToGoal, Sitecore.Analytics.XConnect"/>
<!-- My custom converter -->
<processor type="Client.Project.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToMyCustomEvent, Client.Project, Client.Project" patch:source="Client.Project.config"/>
<!-- Ensure this processor is the last in the pipeline, because this processor converts page event data to default XConnect Event object. -->
<processor type="Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToEvent, Sitecore.Analytics.XConnect"/>
<processor type="Sitecore.FXM.Pipelines.Tracking.ConvertToXConnectEvent.CopyFxmOutcomeData, Sitecore.FXM" runIfAborted="true" patch:source="Sitecore.FXM.config"/>
</convertToXConnectEvent>
I am working off of the following Sitecore guides:
https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-platform/events.html
https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-platform/convert-a-page-event.html
Why might this be happening? What can I do to troubleshoot?
| |
Sitecore's workflow uses /sitecore/templates/System/Workflow/Standard Comment Template/Comment/Comments field to store the key value and when display it in workflow history it uses below config from Sitecore.config file -
<getWorkflowCommentsDisplay help="Processors must accept PipelineArgs of type Sitecore.Pipelines.GetWorkflowCommentsDisplay.GetWorkflowCommentsDisplayArgs">
<processor type="Sitecore.Pipelines.GetWorkflowCommentsDisplay.ExtractFields,
Sitecore.Kernel" singleInstance="false">
<Fields hint="list:AddField">
<Comments>Comments</Comments>
</Fields>
</processor>
</getWorkflowCommentsDisplay>
Ideally this field name /sitecore/templates/System/Workflow/Standard Comment Template/Comment/Comments and this value <Comments>Comments</Comments> in config should be same.
To fix this you can do any of the below two options -
Change the config value to comment as you already have comments added in the table, no major impact but need to take care during the upgrade as it is not OOTB Sitecore value.
Update the template field value to Comments but you also need to run SQL command to fix this for already added comments which are showing comment as key.
| workflow comments doesn't show up in the Workflow history
We have a interesting issue related to the workflow comments.
We are using lion bridge workflow for the items. When the workflow command is executed and comment box is filled with comments. Data is saved in the SQL Db but the Key is stored as "comment"
While retrieving the workflow history to view the comments, It is trying to fetch from the key "Comments" hence no comments are shown.
if I update the data in the SQL column to "Comments" it comes up in the History. Does anyone know what could be the issue or from where is the comment box save picking up the value for the "Key"
Attached the screenshot below which shows the json values in the SQL.
| |
looking at this it is because in the treelist SetProperties it sets the Datasource to LowerInvariant
Something like this should work
private string CasedDataSource => StringUtil.ExtractParameter("DataSource", this.Source).Trim();
and use that for all additional logic
| Extending treelist having issues with token resolver
I am following this article to extend treelist field - https://jammykam.wordpress.com/2016/01/06/specifying-query-and-parameters-for-sitecore-treelist-field-source/.
We want to have a treelist field with support of query and other datasource parameters. But adding a query with token is causing issue.
This query is working - datasource=query:$site/Data/Topic
Whereas this is not - datasource=query:$sharedSites/Data/Topic
This is because $sharedSites token is getting converted to lowercase and its not getting resolved. Do we have any way of handling this with modifying the query?
| |
Spatial search is supported by Sitecore out-of-the-box starting from version 9.0 so no additional modules or custom providers are required. See documentation about Sitecore spatial search here.
You can remove all code related to the custom search context and instead use standard search functionality on your upgraded Sitecore 10 website. For example, this is how radius search can be implemented:
using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext())
{
var queryable = context.GetQueryable<SearchResultItem>()
.WithinRadius (s => s.Location, new Coordinate (lat, lng), radius);
var results = queryable.ToList();
}
| Upgrading Custom Sitecore Solr SearchProvider
I am in process of upgrading Sitecore from 8.2 to 10 and also Solr.
SolrSearchWithSpatialContext was implemented by previous team but looks like this code is outdated now and there has been no update.
https://github.com/ehabelgindy/sitecore-solr-spatial/blob/master/Source/Sitecore.ContentSearch.Spatial.Solr/Provider/SolrSearchWithSpatialContext.cs
Basically this class is inherited from SolrSearchContext.
public SolrSearchWithSpatialContext(SolrSearchIndex index,
SearchSecurityOptions options = SearchSecurityOptions.EnableSecurityCheck)
: base(index, index.Locator.GetInstance<ILinqToIndexFactory>() , options)
{
Assert.ArgumentNotNull(index, "index");
Assert.ArgumentNotNull(options, "options");
_contentSearchSettings = index.Locator.GetInstance<IContentSearchConfigurationSettings>();
}
In the new version, an additional parameter,ILinqToIndexFactory ,has been introduced for instantiating SolrSearchContext
I am not able to figure out how to resolve this parameter. I tried few different things but no success and there is hardly any documentation available around this.
I tried passing index.Locator.GetInstance<ILinqToIndexFactory>() but then it throws exception saying Service Sitecore.ContentSearch.Abstractions.Factories.ILinqToIndexFactory was not registered in container
Please if anyone can help. Thanks in advance.
| |
As seen in the official docs you should be assigning the output from New-ItemAcl to a variable and then using Set-ItemAcl to assign to an item; alone it won't change anything on the item.
Note: Add-ItemAcl works with the existing access controls on the item. Set-ItemAcl overwrites with whatever you provide.
From the example here you can see the following:
$acl1 = New-ItemAcl -AccessRight item:delete -PropagationType Any -SecurityPermission AllowAccess -Identity "sitecore\adam"
$acl2 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission DenyAccess -Identity "sitecore\mikey"
Get-Item -Path master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru
Let's say I want to set the inheritance on the item like in the following image:
$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
$aclEntity = New-ItemAcl -Identity "sitecore\Developer" -AccessRight "*" -PropagationType Entity -SecurityPermission AllowInheritance
$aclDescendants = New-ItemAcl -Identity "sitecore\Developer" -AccessRight "*" -PropagationType Descendants -SecurityPermission AllowInheritance
$item | Set-ItemAcl -AccessRules $aclEntity,$aclDescendants -PassThru
Combining our two scripts you can achieve this:
$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
$role = "sitecore\Developer"
$acl1 = New-ItemAcl -AccessRight item:read -PropagationType Any -SecurityPermission AllowAccess -Identity $role
$acl2 = New-ItemAcl -AccessRight item:write -PropagationType Any -SecurityPermission AllowAccess -Identity $role
$acl3 = New-ItemAcl -AccessRight item:rename -PropagationType Descendants -SecurityPermission AllowAccess -Identity $role
$acl3a = New-ItemAcl -AccessRight item:rename -PropagationType Entity -SecurityPermission DenyAccess -Identity $role
$acl4 = New-ItemAcl -AccessRight item:create -PropagationType Any -SecurityPermission AllowAccess -Identity $role
$acl5 = New-ItemAcl -AccessRight item:delete -PropagationType Descendants -SecurityPermission AllowAccess -Identity $role
$acl5a = New-ItemAcl -AccessRight item:delete -PropagationType Entity -SecurityPermission DenyAccess -Identity $role
$acl6 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission AllowInheritance -Identity $role
$aclEntity = New-ItemAcl -Identity $role -AccessRight "*" -PropagationType Entity -SecurityPermission AllowInheritance
$aclDescendants = New-ItemAcl -Identity $role -AccessRight "*" -PropagationType Descendants -SecurityPermission AllowInheritance
$item | Set-ItemAcl -AccessRules $acl1, $acl2, $acl3, $acl3a, $acl4, $acl5, $acl5a, $acl6, $aclEntity, $aclDescendants -PassThru
| PowerShell script to alter item security inheritance
I am working on SPE code to set user permissions for a specific tree item.
$role = "Michael"
$path = "master:\content\home\distributors\a-b\Austria"
$acl1 = New-ItemAcl -AccessRight item:read -PropagationType Any -SecurityPermission AllowAccess -Identity $role
$acl2 = New-ItemAcl -AccessRight item:write -PropagationType Any -SecurityPermission AllowAccess -Identity $role
$acl3 = New-ItemAcl -AccessRight item:rename -PropagationType Descendants -SecurityPermission AllowAccess -Identity $role
$acl3a = New-ItemAcl -AccessRight item:rename -PropagationType Entity -SecurityPermission DenyAccess -Identity $role
$acl4 = New-ItemAcl -AccessRight item:create -PropagationType Any -SecurityPermission AllowAccess -Identity $role
$acl5 = New-ItemAcl -AccessRight item:delete -PropagationType Descendants -SecurityPermission AllowAccess -Identity $role
$acl5a = New-ItemAcl -AccessRight item:delete -PropagationType Entity -SecurityPermission DenyAccess -Identity $role
$acl6 = New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission AllowInheritance -Identity $role
Get-Item -Path $path | Add-ItemAcl -AccessRules $acl1, $acl2, $acl3, $acl3a, $acl4, $acl5, $acl5a, $acl6 -PassThru
This is working to set the item and descendants for read, write, rename, create, and delete.
I can't figure out how to also set the inheritance option for item and descendants though.
It doesn't seem I can do item:inheritance under -AccessRight.
When I try doing: New-ItemAcl -AccessRight item:read -PropagationType Descendants -SecurityPermission AllowInheritance -Identity $role it doesn't do anything.
Any thoughts on this?
| |
Issue was due to module SitecoreFundamentals installed. Uninstalled it and it solved the issue
| Unable to install Sitecore 9.0.2 while having Sitecore 10
Trying to install Sitecore 9.0.2 on a machine that already has Sitecore 10. However, getting below error. Do I need to change the Sitecore module?
Install-SitecoreConfiguration : A registration exists for the Task 'AddWebFeatureSSL' (Invoke-AddWebFeatureSSLTask).
Use -Force to override.
output file is C:\Workspace\sc902_install\xconnect-createcert.220805.log
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.2.1\Private\RegistrationHandler.ps1:82 char:9
| |
Here is something that can help you.
If you know the URL of the Module then try removing .aspx from the URL for example if the module URL is
http://marketplace.sitecore.net/Modules/L/Language_And_Version_Manager.aspx
then remove the .aspx from the last and try
http://marketplace.sitecore.net/Modules/L/Language_And_Version_Manager
Here is the accepted solution link for this.
https://community.sitecore.com/community?id=community_question&sys_id=4e30a69b1b54d190e55241dde54bcb50
| User can not download old modules from sitecore market place
Go to sitecore market place site. And try downloading any module.
User is redirected to new market place link mentioned below.
https://marketplace.sitecore.net/SearchResults#qr=powershell%20extension
https://www.sitecore.com/products/marketplace?sc_lang=en
And the sitecore modules not found on new site when you search on new platform.
Anyone has face this problem. Below are couple of example
https://marketplace.sitecore.net/en/Modules/Secure_File_Upload
https://marketplace.sitecore.net/en/Modules/P/Point_of_Interest_Module.aspx
https://marketplace.sitecore.net/Modules/S/Sitecore_PowerShell_console.aspx?sc_lang=en
| |
This happens when you have not enabled the IdentityServer configuration for Unicorn. Please enable it.
It's this file. It has extension .disabled by default.
https://github.com/SitecoreUnicorn/Unicorn/blob/master/src/Unicorn/Standard%20Config%20Files/Unicorn.UI.IdentityServer.config.disabled
For more information, see https://viniciusdeschamps.com.br/solved-unicorn-issue-with-sitecore-identity/
| Status code 418 in Unicorn
Environment: Sitecore.NET 10.1.1
Hi All,
We have our solution in Azure PAAS. 2 days back while deploying to one of our environments, we encountered a strange error.
Once we triggered the Unicorn for data sync, we received an error code as 418.
Please see the attached image. The error disappeared once we re-tried the sync.
I checked the documentation and the literature around the bug. Unfortunately, I could not find anything guiding me in any particular direction.
| |
I did a few things, and after that, it started working:
First check if xDB is enabled, which was enabled already
Then I checked if "SC_ANALYTICS_GLOBAL_COOKIE" is coming or not, which was not coming on the server so I checked "Analytics.CookieDomain" setting which was wrong so I updated that setting
<setting name="Analytics.CookieDomain" value="******" />
| Contact is null
I am working on Sitecore 10.2 and trying to update facets in xDB. The below function is working fine on local but it is not working on VM. xDB is enabled on Sitecore instance.
public bool SaveContactData(string firstName, string lastName, string identifierSource, string email, string phoneNumber, string language, string userAgent)
{
try
{
var contactReference = GetIdentifiedContactReference(identifierSource, email);
using (var client = SitecoreXConnectClientConfiguration.GetClient())
{
var contact = client.Get(contactReference, new ContactExpandOptions(CollectionModel.FacetKeys.PersonalInformation, CollectionModel.FacetKeys.EmailAddressList, PhoneNumberList.DefaultFacetKey));
//CONTACT IS COMING NULL
}
return true;
}
catch (Exception ex)
{
Log.Error("Error saving data to profile", ex, this);
return false;
}
}
private IdentifiedContactReference GetIdentifiedContactReference(string identifierSource, string identifier)
{
if (Tracker.Enabled && !Tracker.Current.IsActive)
{
Tracker.StartTracking();
}
if (Tracker.Current?.Contact == null)
{
Log.Warn("Tracker.Current?.Contact == null", this);
return null;
}
if (Tracker.Current.Contact.IsNew)
{
Tracker.Current.Contact.ContactSaveMode = ContactSaveMode.AlwaysSave;
_contactManager.SaveContactToCollectionDb(Tracker.Current.Contact);
IdentifyContact(identifierSource, identifier);
return new IdentifiedContactReference(identifierSource, identifier);
}
var id = Tracker.Current.Contact.Identifiers.FirstOrDefault();
return Tracker.Current.Contact.IsNew || Tracker.Current.Contact.Identifiers.Count == 0
? new IdentifiedContactReference(identifierSource, identifier)
: new IdentifiedContactReference(id?.Source, id?.Identifier);
}
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.