# Category page doesn't work in test- but works in local- and prod-environments

**URL:** https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022
**Category:** Questions
**Tags:** litium-7, accelerator
**Created:** [April 26, 2021, 10:29am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022 "2021-04-26T10:29:32Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![PierreNilsson](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@PierreNilsson](https://forum.litium.com/u/PierreNilsson)
#### Post date: [April 26, 2021, 10:29am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/1 "2021-04-26T10:29:32Z")

</div>

Experiencing YSODs when visiting some of the category pages, but only on the litium test-environment.

After restoring the production database to the test-environment (litium hosted) we started seeing YSODs cropping up when browsing the category page on the test-environment.

The error doesn’t crop up on prod so I figured I’d restore the test-db locally to trouble-shoot the problem but, as it turns out, the error doesn’t turn up locally either.

So the error is reproduceable on test-env but not on prod or locally.

Does anybody has an incling of what could make the category page fail on test but not on local or prod?

I have re-build and re-updated the search indices in case the search was the culprit but that doesn’t seem to help.

**The error is:**

```auto
    [NullReferenceException: Object reference not set to an instance of an object.]
       Litium.Accelerator.Search.<>c __DisplayClass12_0.<CreateProductModel>b__ 0(Variant x) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:185
       System.Linq.WhereEnumerableIterator`1.MoveNext() +197
       System.Linq.Buffer`1..ctor(IEnumerable`1 source) +280
       System.Linq.<GetEnumerator>d__1.MoveNext() +115
       System.Linq.Enumerable.Count(IEnumerable`1 source) +258
       Litium.Accelerator.Search.ProductSearchService.CreateProductModel(SearchQuery searchQuery, IEnumerable`1 variants) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:214
       Litium.Accelerator.Search.ProductSearchService.CreateProductModels(Collection`1 hits, SearchQuery searchQuery) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:278
       Litium.Accelerator.Search.ProductSearchService.TransformSearchResult(Int32 pageSize, SearchQuery searchQuery, SearchResponse searchResponse) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:347
       System.Lazy`1.CreateValue() +708
       System.Lazy`1.LazyInitValue() +184
       Litium.Accelerator.Builders.Product.ProductListViewModelBuilder.Build() in C:\Code\Prosupport\Src\Litium.Accelerator\Builders\Product\ProductListViewModelBuilder.cs:45
       lambda_method(Closure , ControllerBase , Object[] ) +91
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
       System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
       System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +70
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
       System.Web.Mvc.Async.<>c __DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__ 0() +80
       System.Web.Mvc.Async.<>c __DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__ 2() +387
       System.Web.Mvc.Async.<>c __DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__ 2() +387
       System.Web.Mvc.Async.<>c __DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__ 2() +387
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
       System.Web.Mvc.Async.<>c __DisplayClass3_6.<BeginInvokeAction>b__ 4() +50
       System.Web.Mvc.Async.<>c __DisplayClass3_1.<BeginInvokeAction>b__ 1(IAsyncResult asyncResult) +188
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
       System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +68
       System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
       System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
       System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +68
       System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +648
       System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131

**Row 185:**
    variants = variants
                    .Where(x => x.ChannelLinks.Any(z => z.ChannelSystemId == _requestModelAccessor.RequestModel.ChannelModel.Channel.SystemId))
                    .OrderBy(x => x.SortIndex);

```

As far as I know, no changes has been made to ProductSearchService.cs in the accelerator.

So what can make variants be null on row 185 on test-env but not locally and prod when using the same db?

Litium version: _[7.1]_

---

<div class="post-metadata">

### Author: ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)
#### Post date: [April 26, 2021, 3:48pm UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/2 "2021-04-26T15:48:04Z")

</div>

Did you restart the application-pool on Test Env when you swapped the DB?

---

<div class="post-metadata">

### Author: ![PierreNilsson](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@PierreNilsson](https://forum.litium.com/u/PierreNilsson)
#### Post date: [April 27, 2021, 6:18am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/3 "2021-04-27T06:18:31Z")

</div>

We only have access via ftp, so I haven’t. But I have forced a restart via web.config (connection string change).

Edit:  
Is restart via change in web.config not enough?

---

<div class="post-metadata">

### Author: ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)
#### Post date: [April 27, 2021, 8:00am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/4 "2021-04-27T08:00:10Z")

</div>

I think it just restarts the site and do not reset app-pool. Ask support to recycle application-pool and try.

---

<div class="post-metadata">

### Author: ![PierreNilsson](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@PierreNilsson](https://forum.litium.com/u/PierreNilsson)
#### Post date: [April 27, 2021, 8:33am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/5 "2021-04-27T08:33:20Z")

</div>

The problem persisted after the app-pool was reset, unfortunately.

---

<div class="post-metadata">

### Author: ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)
#### Post date: [April 27, 2021, 8:41am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/6 "2021-04-27T08:41:18Z")

</div>

Do you have exactly the same code base?

---

<div class="post-metadata">

### Author: ![PierreNilsson](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@PierreNilsson](https://forum.litium.com/u/PierreNilsson)
#### Post date: [April 27, 2021, 8:53am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/7 "2021-04-27T08:53:12Z")

</div>

Yes, test and local environments is running the exact same code-base.

---

<div class="post-metadata">

### Author: ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)
#### Post date: [April 27, 2021, 8:58am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/8 "2021-04-27T08:58:05Z")

</div>

Ok rebuild the indices ones more now when app-pool recycled and try.

---

<div class="post-metadata">

### Author: ![PierreNilsson](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@PierreNilsson](https://forum.litium.com/u/PierreNilsson)
#### Post date: [April 27, 2021, 9:35am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/9 "2021-04-27T09:35:36Z")

</div>

No change after rebuilding indices after the app-pool was restarted. But the sizes of the categories and products differs between test and local:

**Local:**  
Categories: 295 kB  
Products: 163 MB

**Test:**  
Categories: 610 kB  
Products: 273 MB

… although they have the same amount of products and categories:

**Local and test:**  
Assortments: 1  
Categories: 58  
Products: 863  
BaseProducts/Variants: 614/863

Although I now notice that the size (both category and products) differs after hitting “Rebuild All” on the same environment, even after giving the indices some time to finish.

**Test first rebuild:**  
Categories: 383 kB  
Products: 185 MB

**Test second rebuild:**  
Categories: 532 kB  
Products: 75 MB

**Test third rebuild:**  
Categories: 676 kB  
Products: 92 MB

I would expect the size to be at least constant when rebuilding the indices on the same env when using the same db.

---

<div class="post-metadata">

### Author: ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)
#### Post date: [April 27, 2021, 11:56am UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/10 "2021-04-27T11:56:22Z")

</div>

So every time you rebuild the indices they grow?

---

<div class="post-metadata">

### Author: ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)
#### Post date: [April 27, 2021, 12:06pm UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/11 "2021-04-27T12:06:05Z")

</div>

Also is all the channel information and domain url’s, prefixes, permissions on all entities correct on Test env?

---

<div class="post-metadata">

### Author: ![PierreNilsson](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@PierreNilsson](https://forum.litium.com/u/PierreNilsson)
#### Post date: [April 27, 2021, 12:26pm UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/12 "2021-04-27T12:26:07Z")

</div>

I’m stupid.

When rebuilding the search indices I used Products \> Search Indices

![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/e476161a08ad5a8eb2cf6b8a6fa380b2bcf65a3b.png)

I didn’t know / forgot that there is an aditional search index feature under System Settings \> Search Indices

![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/bac9d0cc242d1551463ac65f1920e9aeb99a3893.png)

When running this feature, the page renders without errors.

Thanks Steve for hanging in there and helping with this.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)
#### Post date: [May 25, 2021, 12:26pm UTC](https://forum.litium.com/t/category-page-doesnt-work-in-test-but-works-in-local-and-prod-environments/2022/13 "2021-05-25T12:26:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
