Umbraco cloud : 500 Error Occurs Randomly – Works After Restart or Cache Rebuild

Hello Folks,

Umbraco version : 13.8.1

I’m facing a very strange issue on website which is hosted on umbraco cloud. I have a Site Settings node in the backoffice which is used to serve the footer content. At random intervals(in days), the website starts throwing a 500 error.

Once I republish the Site Settings node, rebuild the cache, or restart the site, it starts working fine again. However, after some time, the issue repeats.

Anyone facing this same issue?

Thanks in advance.

Is anything listed in the Umbraco/Server logs?

@NikhilPrajapati

I traced my conversation with our Senior Developer….We actually faced a similar issue with our site Banner setting

In our case, it turned out to be an issue with the node itself. On Live, we created a different/new node and used that instead. After doing that, even when refreshing the memory cache, the banner did not disappear. it was a bit strange..

Yes, it will always throw an object null reference exception because it is not able to construct the Model itself.

Which Models builder mode?

It’s set as “SourceCodeAuto”

Worth checking disk space. Have you got a lot of logs built up in the logs folder?

Any chance you could paste the full stack trace to try and narrow it down?

System.NullReferenceException: Object reference not set to an instance of an object.
   at AspNetCore.Views_Partials_Components_Footer_Default.ExecuteAsync() in C:\home\site\wwwroot\Views\Partials\Components\Footer\Default.cshtml:line 3

The code at line 3 is:

Model.Title

The issue was resolved after restarting the site and rebuilding the cache. However, I would like to understand why this is occurring and what the permanent solution would be to prevent it from happening again.

Could Model or Model.Title be null at any point?

You could add a null check around Model.Titlein your partial and see if that makes a difference. I would also ensure you are passing in a Model too where you are adding the partial, something like

@await Html.PartialAsync(“Footer/Default”, Model)

@EssCee I know, condition check can prevent exceptions however my question is little different.

Does the site have multiple languages / cultures?

Yes @protherj it has 2 languages.

I’ve read that some people have recreated their Site Settings and it has fixed similar issues. Maybe worth a try?

Thanks Jason,

I would try it. I have raised similar issue with cloud support team as well. Let’s see.