I have sites on multiple orgs which have a visualforce page. On this visualforce page in an apex:actionFunction
with a rerender and an oncomplete.
The idea is to have a spinner on the page until the rerender is finished, and then the oncomplete will remove the spinner.
The problem is that (most times, rarely I'll refresh and it will work) the spinner never goes away. But the weird thing is that it only happens in some orgs. It seems to be related to an error displayed in chrome dev console:
3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1669236224000:111 GET https://abc.my.salesforce-sites.com/jslibrary/jslabels/1669553631000/en_AU.js net::ERR_ABORTED 404
If it does happen to work on a refresh, this error is not printed. It also doesn't display in the orgs where it works.
Out of 4 orgs, in the 2 orgs where this problem happens I've noticed that the instance is AUSxx and the 2 orgs where it works are APxx. (scratchorgs (CSxx) also work fine). So I think this might be related to the issues.
What's causing this issue and how can I fix or workaround it?
On further investigation it seems like in https://abcd.my.salesforce-sites.com/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1669236224000 when it works it's because it finds a matching script in oldscripts. When it fails to work there's no match and it tries to head.appendChild(script)
which ends up failing. Looking at all the values of script in oldscripts it seems like the number has changed.
src nosessionhref = '/jslibrary/jslabels/1669759115000/en_AU.js'
oldscripts[4] nosessionhref = '/jslibrary/jslabels/1669551527000/en_AU.js'
The slightly different numbers appear to be the cause of the issue. but I have no idea where these come from or how to change it (or if it's even the actual cause of the issue).