Uncaught TypeError: Cannot read property 'csp_nonce' of undefined (Soy parser)

I am trying to upgrade a page which was working on Jira 7.9 to 8.5.

The problem i am facing is that the soy parse is throwing below error.
Uncaught TypeError: Cannot read property ‘csp_nonce’ of undefined

After debugging i have found out that this error is thrown when i include specifically below code snippet

                        <button class="aui-button">
                            <span class="aui-icon aui-icon-small aui-iconfont-vid-pause">Pause synce</span>
                        </button>
                        <button class="aui-button" style="padding-left: 10px;">
                            <span class="aui-icon aui-icon-small aui-iconfont-refresh">Resume sync</span>
                        </button>
                        <button class="aui-button" style="padding-left: 10px;">
                            <span class="aui-icon aui-icon-small aui-iconfont-error">Force Sync</span>
                        </button>

Based on 8.5.0 AUI, I don’t see any problem with the code. Any help would be appreciated.

To answer my question -
I made a stupid mistake. After correcting my code as given in AUI document. I was still getting the error because the page was cached and I probably did not do a hard refresh at the time.

In JavaScript almost everything is an object, null and undefined are exceptions. This error occurs when a property is read or a function is called on an undefined variable. Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or a property on such a variable causes the TypeError: Cannot read property of undefined.

If you are not sure a variable that will always have some value, the best practice is to check the value of variables for null or undefined before using them. To avoid getting these types of errors, you need to make sure that the variables you are trying to read do have the correct value. This can be done in various ways. You can do if checks before dealing with objects whose values are bound to change:

if (myVar !== undefined) {
    ...
}

Or

if (typeof(myVar) !== 'undefined') {
    ...
}