从 7 月 19 日 23.45 GTM +1 开始,我们所有使用 platform.js(实时和测试中)的应用程序开始在加载 platform.js 中的 gapi 功能时抛出异常。没有进行任何代码更改,错误立即开始在各处发生。
app.js:178 Uncaught TypeError: Cannot read property 'init' of undefined (指 gapi.auth.init)
未捕获的类型错误:_.Rp 不是函数
两个错误都源自 platform.js
我尝试重建前端的 js 项目,但没有成功,也尝试<script src="https://apis.google.com/js/client.js"></script>
在加载 platform.js 之前添加,但无济于事。
现在是凌晨 1.30,提前感谢一位非常疲惫的开发人员。
loadGoogleApi: function (callback, context) {
var self = this;
if (typeof gapi == 'undefined') {
callback.apply(context || self);
return;
}
return gapi.load('auth2', function() {
self.auth2 = gapi.auth2.init({
scope: 'profile email',
client_id: Core.googleClientId
});
self.auth2.currentUser.listen(function (user) {
debug.log('Google user', user);
app.googleUser = user;
});
callback.apply(context || self);
});