Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bug in google drive SDK JS api (TypeError: Cannot read property 'sl' of undefined)

A few weeks ago we started noticing strange errors from the google client API or google drive JS api (not sure which, the URL reference is below), they have increased in frequency over the last few days

 TypeError: Cannot read property 'sl' of undefined

This seems to be affecting windows Chrome mostly - a typical example of the user agent from our error logs is

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31)

from what I could see, the only line with .sl is this:

if(!this.b.headers.Authorization){var f=(0,_.Hx)(_.p,_.p);f&&f[_.Ak.pl.sl]&&(c=f[_.Ak.pl.sl].split(/\w+/))}

this comes from

https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.uSTvEdNXb7o.O/m=client/rt=j/sv=1/d=1/ed=1/am=UQ/rs=AItRSTOm1KS5pZVEepZkn9qQJeuQZC_Qjw/cb=gapi.loaded_0

I know this is intentionally cryptic, so it's beyond me to suggest how to fix it, but I would appreciate if someone looks into this as the frequency seems to be increasing. Perhaps a guard around _Ak.pl to check if it's not null before executing .sl ?

like image 515
Gojko Adzic Avatar asked Apr 25 '13 17:04

Gojko Adzic


1 Answers

I managed to resolve the problem which was reported. The issue is due to the authorize settings. Some settings seems to be not working for the app. Now the app works with following settings:

gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);

Previously the app was configured to run offline.

Note: In the code, clientId and scopes are variables, handleAuthResult is an associated function.

like image 174
IvenMS Avatar answered Oct 12 '22 09:10

IvenMS