Lightning Component and JS error Spring 18 (API V42). Working fine on API V41

I have traced the execution of code and as soon as the execution of our code is over it goes straight to an Error from SF. no errors are thrown prior to this and the last line of code executed is

  },

at the end of a function.

SF throws 6 errors in rapid succession:

First Error – We’re reporting this as error ID: -985448148

Cannot assign to read only property ‘target’ of object ‘#’]
Object.n.writable.a.set as target@https://sdmc-sandbox–fsandbox.lightning.force.com/auraFW/javascript/rtepOYea-S8oL5NxS08JXw/aura_prod.js:24:75059
Proxy.eval()@https://sdmc-sandbox–fsandbox.lightning.force.com/resource/1517858704000/jsAssets/js/jquery.payform.js:85:16
Object.setFocus()@https://sdmc-sandbox–fsandbox.lightning.force.com/libraries/ui/panelLib/panelLibCore.js:14:409
HTMLDivElement.eval()@https://sdmc-sandbox–fsandbox.lightning.force.com/libraries/ui/panelLib/panelLibCore.js:8:19

Second Error – We’re reporting this as error ID: -1973561471

Cannot assign to read only property ‘target’ of object ‘#’]
Object.n.writable.a.set as target@https://sdmc-sandbox–fsandbox.lightning.force.com/auraFW/javascript/rtepOYea-S8oL5NxS08JXw/aura_prod.js:24:75059
Proxy.eval()@https://sdmc-sandbox–fsandbox.lightning.force.com/resource/1517858704000/jsAssets/js/jquery.payform.js:85:16

Third, Fourth, Fifth, and Sixth Error – We’re reporting this as error ID: -1973561471

Cannot assign to read only property ‘target’ of object ‘#’]
Object.n.writable.a.set as target@https://sdmc-sandbox–fsandbox.lightning.force.com/auraFW/javascript/rtepOYea-S8oL5NxS08JXw/aura_prod.js:24:75059
Proxy.eval()@https://sdmc-sandbox–fsandbox.lightning.force.com/resource/1517858704000/jsAssets/js/jquery.payform.js:85:16

Fourth Error – We’re reporting this as error ID: -1973561471

Cannot assign to read only property ‘target’ of object ‘#’]
Object.n.writable.a.set as target@https://sdmc-sandbox–fsandbox.lightning.force.com/auraFW/javascript/rtepOYea-S8oL5NxS08JXw/aura_prod.js:24:75059
Proxy.eval()@https://sdmc-sandbox–fsandbox.lightning.force.com/resource/1517858704000/jsAssets/js/jquery.payform.js:85:16

Now, They all seem to be related to the Payform JS but it is working just fine in orgs on API v41. The only difference is the API version (although there may be critical update or configuration differences but not sure if any would cause this)

All the inputs are standard HTML inputs <input aura:id"..."..>

Any clues on what may be going on here or how to fix it? Was there a change in Spring 18 that broke something or requires something different from JS libraries?

Components are all on V40.0 and Locker Service is enabled and has been working prior to API v42

Line 85 of the JS code is

  if (ele.addEventListener != null) {

UPDATE 2-13-2014

So I have narrowed it down to this section of code

_eventNormalize = function(listener) {
    return function(e) {
      if (e == null) {
        e = window.event;
      }
      e.target = e.target || e.srcElement; ******IT ERRORS HERE ON = e.target
      e.which = e.which || e.keyCode;
      if (e.preventDefault == null) {
        e.preventDefault = function() {
          return this.returnValue = false;
        };
      }
      return listener(e);
    };
  };

I also found that using Safari the error does not appear.

The error happens in Chrome on orgs that have been updated to API v42 but not on orgs that are on v41

So something in Orgs upgrading from v41 to v42 causes this error when using chrome browsers only…..

Still working the support back and forth game with SF support without resolution but at least they are trying….

Update 2-15-2018

Unfortunately if your code breaks and the only thing that changes is a salesforce org API version – Org Update – Salesforce will not support that. If one was to read into the response then they do not support any development that is broken by an API update. It used to be that API updates at least did not affect items on previous API versions….I guess the hundreds of thousands we pay them and the fact that it is a production halt is not sufficient to warrant a single phone call from someone above tier 1 that could spend 5 minutes on a screen share to figure out what is going on….

So frustrating…..

Answer

Code issues caused by Salesforce API upgrades / org API updates are not supported by salesforce. If they break your code you are on your own.

Only resolution is to wrap the code in a try catch block and hope the functionality is not needed.

Attribution
Source : Link , Question Author : Eric , Answer Author : Eric

Leave a Comment