Sitecore + SalesForce – Troubleshooting Sitecore Connect Endpoint Connection Failures

Dear Sitecore Family,

Hope you liked the post on Getting Started with Sitecore Connect, by setting it up Sitecore Connect for SalesForce CRM.

But, while doing so, you faced issues either connecting to the SalesForce Endpoint or xConnect Endpoint? OR you are curious to know what to do in case you face one in future?

Well, if Yes is the answer in any one of the above two questions, then this is a post for you!

Let’s Divide this post into two:

  1. Troubleshooting the SalesForce Endpoint Connection Issue
  2. Troubleshooting the xConnect Endpoint Connection Issue

Troubleshooting the SalesForce Endpoint Connection Issue:

A. Check the pieces linking to the connection with SalesForce

So, we have a new entry added the ConnectionStrings.config when we are connecting to the SalesForce Connected App.

The format was this <add name=”mysf” connectionString=”user id=[user id];password=[password];client id=[client id];secret key=[secret key];security token= [security token]” />

Based on those entries we need to check the following pieces in case we face a Connection Failure:

  • Username
  • Password
  • Security Token of the User
  • Client ID of the Connected App
  • Client Secret – of the Connected App – which is entered into the secret key

The good thing is in case we messed up with any of the above details, then it will give us an error saying authentication failure.

In case all these check out to be correct, we need to check the SalesForce Client Endpoint – it is at the following location: /sitecore/system/Data Exchange/Salesforce Tenant/Endpoints/Providers/Salesforce/Salesforce Client Endpoint

Here, we need to check that the connectionstring name entered, is same as what we added to the ConnectionStrings.config file for SalesForce.

In case we are facing any difficulty with the connection, one of the above would definitely not be in its place.

B. Try recycling the app pool

I faced this with I was setting up my Sitecore environment for the presentation. I had all things set right and I was still facing connection issues with SalesForce!

I checked and rechecked everything and nothing worked. Later, I don’t know what came to my mind, I did IIS Reset on command prompt, and voila! It worked!

Hence, this point! If everything is set correctly, but still you face connection issues, try recycling the App Pool of your Sitecore Website.

C. Check the Sitecore Logs for details in case all others checkout.

As Sitecore Developers we know, how Sitecore Logs come in handy in case of any issues.

Similar to all others, for this one as well, it stands true.

Like say, when I specifically entered a wrong value above to get the authentication failure, the following Log entry is visible in the Sitecore Log files:

121628 15:15:42 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type ‘System.Web.HttpUnhandledException’ was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
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.AggregateException
Message: One or more errors occurred.
Source: mscorlib
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Sitecore.DataExchange.Providers.Salesforce.Endpoints.AuthenticationClientSettings.get_AuthenticationClient()
at Sitecore.DataExchange.Providers.Salesforce.Endpoints.SalesforceClientEndpointTroubleshooter.Troubleshoot(Endpoint endpoint, TroubleshooterContext context)
at Sitecore.DataExchange.Troubleshooters.BaseEndpointTroubleshooter.Troubleshoot(TroubleshooterContext context)
at Sitecore.DataExchange.Local.Commands.RunTroubleshooterCommand.Execute(CommandContext context)
at Sitecore.Shell.Framework.Dispatcher.Dispatch(Message message, CommandContext context)
at Sitecore.Shell.Applications.ContentManager.ContentEditorForm.HandleMessage(Message message)
at Sitecore.Shell.Framework.Commands.MessageCommand.Execute(CommandContext context)
at Sitecore.Web.UI.Sheer.ClientPage.Dispatch(String command)
at Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent()
at Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e)
at Sitecore.Shell.Applications.ContentManager.ContentEditorPage.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Nested Exception

Exception: Salesforce.Common.ForceAuthException
Message: authentication failure
Source: Salesforce.Common
at Salesforce.Common.AuthenticationClient.<UsernamePasswordAsync>d__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.DataExchange.Providers.Salesforce.Endpoints.AuthenticationClientSettings.<<get_AuthenticationClient>b__18_0>d.MoveNext()

So, I am sure, for any other issue other than the ones mentioned here, Sitecore logs will come in handy!

Now, lets move on to the second one.

Troubleshooting the xConnect Endpoint Connection Issue:

A. Check the two field names we entered

  • Collection Service Connection String Name  =  “xconnect.collection”
  • Collection Service Certificate Connection String Name = “xconnect.collection.certificate”

B. Check the above two connection string entries

Now, the above two connectionstring entries are by default when we install Sitecore, but good to check they are mapped correctly.

  • Check that xConnect instance is up and running.
  • Check that the Self-Signed Certificate is trusted – check from the MMC
  • Verify that the Thumbprint is valid – and that of the certificate currently in use

C. Its advised to have Allow Invalid Certificates checked to avoid issues due to Certificates.

Now, even if we checked all the things above, its good to check the checkbox for Allow Invalid Certificates

D. Check the Sitecore Logs for details as always.

Again, if nothing helps, Sitecore logs do! So don’t forget to check them in case none of the following works.

Happy Sitecore Troubleshooting! 🙂

2 thoughts on “Sitecore + SalesForce – Troubleshooting Sitecore Connect Endpoint Connection Failures

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.