A common error thrown both in customerror logs and the error logs points to an issue with reading a property or calling a method on an object that is null or empty. This error can be very common, but it can also be resolved and avoided easily.
A common error thrown both in customerror logs and the error logs points to an issue with reading a property or calling a method on an object that is null or empty. This error can be very common, but it can also be resolved and avoided easily.
You can see these errors in the customerror logs, but more often than not they will be found in the server error logs. Example errors usually read like:
TypeError: Cannot call method getPrice of null ([Template:product/components/standardprice:${! PriceModel.getPrice().available}]#1)"
TypeError: Cannot read property ID from null ([Template:search/components/jsrefinementsupdate:${pdict.ProductSearchResult.category.ID}]#1)"
If you are seeing these typeErrors in your logs, the root cause of the issue is that the object that you are attempting to read a property from or call a method of, is empty or null.
Any typeErrors (where a property or method cannot be read or called because of a null object) will log both the underlying template and the line in the template where the error is being thrown.
Investigate these templates and find the line where the method call or property read is happening. To resolve these errors, a check on the null or empty object has to occur.
For example, using the second error above, the code causing the error could look like this:
<isset name="categoryID" value="${pdict.ProductSearchResult.category.ID}"/>
To avoid the error, add a check that the object being read from is not null or empty:
<isif condition="${!empty(pdict.ProductSearchResult.category)}">
<isset name="categoryID" value="${pdict.ProductSearchResult.category.ID}"/>
</isif>
This will ensure that there is in fact an object to be read from and further, that the new variable will in fact have a value.
000391353

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.