I can't say how much has changed in five years - but I suggest you to debug it by looking into the properties of 'this' in this.appConfig.portalUrl - since the error message implies that appConfig is null - maybe this has changed since 2015? Or maybe the 'this' in your script point to something else? Anyway, good luck.