Troubleshooting with Sitecore JSS Deployment problems

Sitecore JSS Deployment Troubleshooting

These are the very basic mistakes but one get so much troubled again and again.

There are complete steps available of how to get started with Sitecore JSS. Just for a quick start and stay on the topic, there is a short overview of commands.

Download node.js if you haven’t yet. We are sticking to the React.js for now so, just run these commands:

npm install -g @sitecore-jss/sitecore-jss-cli 
jss create my-first-jss-app react 
cd my-first-jss-app 
jss start

Follow the complete JSS docs for better understanding.


Problem 1 – JSS deploy command does not deploy config

After performing  JSS setup completely and then running the JSS deploy config command, you might have noticed that the configurations in your my-first-jss-app.config file, in your folder  C:\inetpub\wwwroot\[jss.sc]\App_Config\Include\zzz are not what expected. It looks like this.

2018-09-02_1220

It is because that the configs are setup that allows the communication between JSS and Sitecore instance. But the config file in your instance was not modified with the JSS setup command.

Solution:

You can manually edit your config file before performing JSS deploy config . Just update the hostName and you are good to go.

1 thing to make sure is that, in your config file, the site inherits from inherits="Website" while there was nothing asked about the site inheritance while performing JSS setup.

Just empty it and run JSS deploy config

2018-09-02_1227.png


Problem 2 – JSS deployment and default page URL

It happens that after complete deployment of JSS app, the homepage does not reflect on the website, after hitting the desired url, in my case it is http://jss.sc/ it is showing the Sitecore default page.

2018-09-01_2141

Your console will not show anything, and the app is deployed fine. This is how it will show.

2018-09-02_1236.png

Solution:

There are few things you might have noticed, that after running JSS setup, you provide the hostname as http://jss.sc/ including http so your config files

2018-09-01_2131

But here you might be mistaking by putting the http in hostName http://jss.sc/

Just update your config file without the http in the hostName.

2018-09-02_1239.png

Now deploy the configs.

2018-09-02_1246.png

Tip:

You can access the admin ShowConfigs in order to validate the configs.

http://jss.sc/sitecore/admin/ShowConfig.aspx

Search for your desired hostName.

2018-09-02_1250.png


Problem 3 – JSS deployment and connected mode

When you run the JSS connected mode, it does not work, and you get the following screen.

2018-09-03_1255.png

In order to validate if it is connected mode, Press CTRL + U and check if the div of the id=root is not empty.

2018-09-03_1255_001.png

Solution:

Make sure you have updated the CORS origins in your CORE database, at the location

/sitecore/templates/System/Services/API Key/

2018-09-03_1251.png

Tip:

And don’t add the / at the end of the URL.


Problem 4 – JSS deployment issue with react

JSS deployment issue with react, using Tech Preview 4. This is how it will show.

2018-08-15_1454.png

Here is the complete log:

PS F:\Drive\my-first-jss-app> jss deploy app -c -d
JSS is creating a manifest for my-first-jss-app to ./sitecore/manifest...
Cleaning path ./sitecore/manifest...
Cleaned:
 F:\Drive\my-first-jss-app\sitecore\manifest\data
F:\Drive\my-first-jss-app\sitecore\manifest\data\media
F:\Drive\my-first-jss-app\sitecore\manifest\data\media\files
F:\Drive\my-first-jss-app\sitecore\manifest\data\media\files\jss.pdf
F:\Drive\my-first-jss-app\sitecore\manifest\data\media\img
F:\Drive\my-first-jss-app\sitecore\manifest\data\media\img\jss_logo.png
F:\Drive\my-first-jss-app\sitecore\manifest\data\media\img\sc_logo.png
F:\Drive\my-first-jss-app\sitecore\manifest\sitecore-import.json
Enabling Babel transpilation for the manifest...
path or pattern './sitecore/pipelines/**/*.patch.js' did not match any files.
path or pattern './sitecore/pipelines/**/*.patch.ts' did not match any files.
copied media from: ./data/media/img/sc_logo.png to: sitecore\manifest\data\media\img\sc_logo.png
copied media from: ./data/media/img/jss_logo.png to: sitecore\manifest\data\media\img\jss_logo.png
copied media from: ./data/media/files/jss.pdf to: sitecore\manifest\data\media\files\jss.pdf
Manifest has been generated and written to ./sitecore/manifest/sitecore-import.json
JSS is manifest packaging my-first-jss-app to ./sitecore/package...
Adding data/media/files/jss.pdf
Adding data/media/img/jss_logo.png
Adding data/media/img/sc_logo.png
Adding sitecore-import.json
Wrote sitecore\package\my-first-jss-app.1534334605998.manifest.zip
Sending package sitecore\package\my-first-jss-app.1534334605998.manifest.zip to http://jssreactweb/sitecore/api/jss/import...
Unexpected response from import service:
Status message: Internal Server Error
Body: <!DOCTYPE html>
<html>
    <head>
        <title>Could not find base site 'website' for site 'my-first-jss-app'.</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>Could not find base site 'website' for site 'my-first-jss-app'.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>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.

            <br><br>

            <b> Exception Details: </b>System.InvalidOperationException: Could not find base site 'website' for site 'my-first-jss-app'.<br><br>

            <b>Source Error:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code>

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.</code>

                  </td>
               </tr>
            </table>

            <br>

            <b>Stack Trace:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

[InvalidOperationException: Could not find base site &#39;website&#39; for site &#39;my-first-jss-app&#39;.]
   Sitecore.Sites.ConfigSiteProvider.AddInheritedProperties(Site site, SafeDictionary`2 siteDictionary) +447
   Sitecore.Sites.ConfigSiteProvider.ResolveInheritance(SiteCollection sites, SafeDictionary`2 siteDictionary) +174
   Sitecore.Sites.ConfigSiteProvider.InitializeSites() +716
   Sitecore.Sites.ConfigSiteProvider.GetSites() +18
   System.Linq.&lt;SelectManyIterator&gt;d__17`2.MoveNext() +292
   Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites) +84
   Sitecore.Sites.SitecoreSiteProvider.GetSites() +218
   Sitecore.Sites.DefaultSiteContextFactory.GetSites() +255
   Sitecore.Sites.DefaultSiteContextFactory.GetSiteContext(String hostName, String fullPath, Int32 portNumber) +124
   Sitecore.Pipelines.PreAuthenticateRequest.SiteResolver.ResolveSiteContext(HttpRequestArgs args) +579
   Sitecore.Pipelines.PreAuthenticateRequest.SiteResolver.Process(HttpRequestArgs args) +14
   (Object , Object[] ) +74
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +469
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Web.RequestEventsHandler.OnBeginRequest(HttpContextBase context) +207
   Sitecore.Nexus.Web.HttpModule.(Object , EventArgs ) +77
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +88
</pre></code>

                  </td>
               </tr>
            </table>

            <br>

            <hr width=100% size=1 color=silver>

            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2556.0

            </font>

    </body>
</html>
<!--
[InvalidOperationException]: Could not find base site &#39;website&#39; for site &#39;my-first-jss-app&#39;.
   at Sitecore.Sites.ConfigSiteProvider.AddInheritedProperties(Site site, SafeDictionary`2 siteDictionary)
   at Sitecore.Sites.ConfigSiteProvider.ResolveInheritance(SiteCollection sites, SafeDictionary`2 siteDictionary)
   at Sitecore.Sites.ConfigSiteProvider.InitializeSites()
   at Sitecore.Sites.ConfigSiteProvider.GetSites()
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites)
   at Sitecore.Sites.SitecoreSiteProvider.GetSites()
   at Sitecore.Sites.DefaultSiteContextFactory.GetSites()
   at Sitecore.Sites.DefaultSiteContextFactory.GetSiteContext(String hostName, String fullPath, Int32 portNumber)
   at Sitecore.Pipelines.PreAuthenticateRequest.SiteResolver.ResolveSiteContext(HttpRequestArgs args)
   at Sitecore.Pipelines.PreAuthenticateRequest.SiteResolver.Process(HttpRequestArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Web.RequestEventsHandler.OnBeginRequest(HttpContextBase context)
   at Sitecore.Nexus.Web.HttpModule.(Object , EventArgs )
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
PS F:\Drive\my-first-jss-app>

Solution:

The JSS Tech Preview 4 works fine on a fresh installed Sitecore 9, but if you were using the older Sitecore Instance with Tech Preview 3 and installing new react app with Tech Preview 4 on it, You will get the above issue, because JSS Tech preview 3 uses JSS Server 8.x whereas JSS Tech Preview 4 is using 9.x. You will need to update:

  • JSS Version
  • Upgrade JSS Cli
  • Add deployment secret (which is new in Tech 4)
  • Upgrade Placeholers

Feel free, to use it and share your feedback. Cheers!

Reference Links

Sitecore Experience Platform 9 update 1

 

Advertisements

1 thought on “Troubleshooting with Sitecore JSS Deployment problems”

Share what's in your Mind :)

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.