Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gapi.client.load started failing on 7/26/2013 - DOM Exception 12 (An invalid or illegal string was specified) error when calling .load #95

Closed
wonderfly opened this issue Jan 7, 2015 · 40 comments

Comments

@wonderfly
Copy link
Contributor

From jarnold...@gmail.com on July 27, 2013 20:17:35

What steps will reproduce the problem? If possible, provide a live demo of the issue. 1. I have written a PhoneGap application using the approach described at this web site: http://www.itsalif.info/content/oauth-google-api-gapi-phonegap-childbrowser-jquery This PhoneGap application essentially allows the use of Google APIs (using the Google API Javascript client) to act as an 'offline web server' client to allow the OAuth API to work from an http://localhost source (the PhoneGap app).

  1. To accomplish this, the app loads the JavaScript client library in index.html with this call:

    <script type="text/javascript" src=" https://apis.google.com/js/client.js?onload=onLoadCallback"></script> 3. This library successfully loads and onLoadCallback is called. (I have a console.log message show that it's called.

    Inside onLoadCallback, gapi.client has been initialized. So, I call:

    gapi.client.load('plus', 'v1', function() {
    console.log('plus loaded!');
    });

  2. The callback is never called. If I hook this up to see what's going on in the Javascript, I see the following error in the console: a DOM Exception 12 ("An invalid or illegal string was specified.") in what appears to be in response to something in the gapi.client call (the reference in the Chrome Javascript console is: https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.W8FmxhqIpgw.O/m=googleapis_proxy/am=EQ/rt=j/d=1/rs=AItRSTMqSYNvDyDFNs8wjPrZc5pR-M_27Q 5. If I comment out the gapi.client.load, this error does not appear. So, since the error reference is from apis.google.com, I'm quite sure that this error occurs during the call to gapi.client.load What is the expected output? What do you see instead? Of special importance: This EXACT CODE (not a single change) worked fine on the evening of 7/25/2013. This behavior started when I got back to work on the morning of 7/26/2013. So, I believe something changed recently that caused this new, error behavior. The code at the website mentioned above has been working since Sept. 2012 and my code has been working since early June (when I started using this model based on the web site). I have contacted the person who posted the web site above and he indicates that his app has stopped working with the same behavior on the same date. What version of the product are you using? On what operating system? I am dynamically load the client.js. So, this worked on and prior to 7/25/2013 and seems to have broken approx. 7/26/2013.

I am using PhoneGap 2.8 and the app is failing as shown above on an iPad and in the Xcode iPad/iPhone simulator running iOS 6.1.3 (latest version)

Original issue: http://code.google.com/p/google-api-javascript-client/issues/detail?id=95

@wonderfly
Copy link
Contributor Author

From thomas.t...@allocab.com on July 29, 2013 04:24:40

We are encountering the same probleme, phonegap loading was perfect until this date and suddenly stopped (no code change).

The problem was encoutered on appengine endpoints so I opened an issue there : https://code.google.com/p/googleappengine/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Component%20Status%20Stars%20Summary%20Language%20Priority%20Owner%20Log&groupby=&sort=&id=9747 phonegap version : 2.7

@wonderfly
Copy link
Contributor Author

From YanisKia...@gmail.com on July 29, 2013 10:17:52

Same problem here with phonegap 2.8.0 to use the Google APIs Client Library for JavaScript.

When can we expect a comeback to the initial situation ?

@wonderfly
Copy link
Contributor Author

From YanisKia...@gmail.com on July 29, 2013 10:20:01

The priority should be "high" --> the mobile applications build through phone gap are not allowed to connect to our API !

@wonderfly
Copy link
Contributor Author

From itsa...@gmail.com on July 29, 2013 12:13:33

We are facing the same problem.

Our existing App in Google Play uses Phonegap/Cordova 2.2. The Apps were working fine before July 25 and then stopped working all of a sudden. There were no code changes.

As already mentioned before, Google Javascript client fails to load library. For example:
gapi.client.load('tasks', 'v1', function() { // this line do not get invoked });

I tried on Phonegap 2.7 and have the same problem. There were no code changes.

The priority should be high.

Thanks,

@wonderfly
Copy link
Contributor Author

From thomas.t...@allocab.com on July 29, 2013 13:36:00

I agree, the priority should be high. All our production apps are freezed due to this behaviour change.

I tried on phonegap 2.6, 2.7, 2.9 and 3.0 on existing projects, new ones, on android and ios : GAPI client refuse to load any API on Phonegap.
(but only on phonegap, on mobile browser its OK)

We are totally dependent on your move for this. so frustrating as it seems to be really a tiny thing causing all this trouble.

Thanks by advance

@wonderfly
Copy link
Contributor Author

From Isis.wo...@gmail.com on July 29, 2013 14:47:41

Same issue with phonegap 3.0, I didn't change anything in the code and it stopped working on July 25.

Please, we need support on this issue.

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on July 29, 2013 16:28:10

Just wanted to let people know that, I too, would like this made a high priority. When I entered the bug, there was no way to set a priority. So, I believe that user-entered issues default to Medium and some action by a team member is needed to make it a High priority. My app/demo is dead in the water too (except for a hastily implemented offline demo mode) and am anxious to resume showing/developing a working app!

  • John -

@wonderfly
Copy link
Contributor Author

From t.tierce...@gmail.com on July 30, 2013 01:47:13

Our apps are back to normal, gapi is correctly loading from phonegap.
Can you confirm this rollback is due to your intervention ? we are waiting for an official announcement to inform our customers.

Thanks by advance

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on July 30, 2013 04:47:54

Yes, it does seem to working again. I, too, am interested in confirmation that the underlying error was found and fixed. Thanks.

@wonderfly
Copy link
Contributor Author

From itsa...@gmail.com on July 30, 2013 09:04:25

Yup, Apps are working again.

Thanks for the fix.

@wonderfly
Copy link
Contributor Author

From titiolin...@gmail.com on July 30, 2013 13:19:32

Still not working for me!
I'm loading the https://apis.google.com/js/client:plusone.js?onload=MyCallback and after calling:

gapi.client.load('plus', 'v1', MyCallback);
or a simple:
gapi.client.load('plus', 'v1', function(){ console.log(1); });

Doesn't work :(

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on July 30, 2013 13:23:35

re: comment #11

My code doesn't try to load both client and plusone in the same call.

We're loading the 'plus' api ('v1') with this code in our index.html:

" https://apis.google.com/js/client.js?onload=onLoadCallback "

Hope this helps...

@wonderfly
Copy link
Contributor Author

From titiolin...@gmail.com on July 30, 2013 13:32:51

re: comment #12
Still not triggering the callback method :(

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on July 30, 2013 13:37:06

This is the exact code - copied/pasted from my index.html file. Note that I've read that this should be the LAST thing before the tag. So that's where I have it.

<script type="text/javascript" src=" https://apis.google.com/js/client.js?onload=onLoadCallback"></script> And, of course, make sure you change onLoadCallback to be the name of your callback function, that it's defined, etc.

Then, in my onLoadCallback, I have this:

    gapi.client.load('plus', 'v1', function() {
                     console.log('plus loaded!');
                     });

And, so far, it's been working all day. Hope this helps.

@wonderfly
Copy link
Contributor Author

From titiolin...@gmail.com on July 30, 2013 13:41:28

Re: #14
Maybe I'm facing a CDN issue. No matter what I do, that callback is never triggered. :-(

@wonderfly
Copy link
Contributor Author

From titiolin...@gmail.com on July 30, 2013 13:56:17

Re: #14 The onLoadCallback is triggered but the gapi.client.load callback doesn't.

@wonderfly
Copy link
Contributor Author

From j...@google.com on July 31, 2013 21:39:37

@titiolinkin: do you see any error messages?
Everyone that's still having issues: please give me as much information as possible.

Thanks!

@wonderfly
Copy link
Contributor Author

From titiolin...@gmail.com on August 01, 2013 03:28:28

No, I'm not but you can get more detailed information at issue #96 .

@wonderfly
Copy link
Contributor Author

From j...@google.com on August 02, 2013 14:58:17

Are any Phonegap apps still experiencing issues with gapi.client.load?

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on August 02, 2013 16:00:41

I'm the original poster and my PhoneGap app (with calls to load 'plus' (v1), 'oauth2' (v2), and our own app engine endpoint have been working ok since Tuesday morning. Thanks for whatever you did to fix it...

@wonderfly
Copy link
Contributor Author

From thomas.t...@allocab.com on August 03, 2013 02:15:09

I don't know what you did but now it's not working again.
It stopped working july 25th, back july 30th and out again this day.

Our businness is based on our mobile apps which cannot work if the client is out.
Please fix this and inform us when you do something as there i a huge impact for us.

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on August 03, 2013 04:43:43

As noted in #22, the apps are broken again. Worked fine on the evening of Aug. 2, 2013. Broken in the morning of Aug. 3, 2013.

It looks like the error is different this time. When I look at the console, there's an error in loading of client.js with this error:

Uncaught TypeError: Object [object Object] has no method 'hefn' at client.js?onload=onLoadCallback:6

As noted in #22, this is a showstopper since it leaves the apps unable to load/use the APIs. Please insert a PhoneGap (or PhoneGap-style) usage in your testing suite so you can catch these things before pushing new code into production.

@wonderfly
Copy link
Contributor Author

From yanisdan...@gmail.com on August 03, 2013 09:05:08

It does not work anymore !
Why the hell do you not consider to test prototype app made with phone gap build before pushing code in production ?

Could you please inform us when the bug is fixed ?

Thanks in advance to consider this issue as a showstopper as mentioned.

@wonderfly
Copy link
Contributor Author

From j...@google.com on August 03, 2013 11:09:38

Hi everyone,

  1. Is this reproducible in a browser--mobile or otherwise?
  2. Can you see if you can reproduce the error with the gapi library in isolaton? (that is, not loading any other js libs like prototype or jquery on the same page)
  3. Also, are any of you using Prototype.js (if so, which version?)?
  4. Can you post the following as an attachment?
    • loaded version of gapi library: go to Chrome developer console > Sources > Sources (might have to clip little square in top left corner) > apis.google.com > somewhere nested should be "cb=gapi.loaded_0"
  5. Everybody aside from jarn..@: at what point are you encountering the error and what error are you seeing?
  6. If you can link me to a page where you're experiencing this issue, it would be greatly appreciated.

Thank you all for your help.

Labels: -Priority-Medium Priority-High

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on August 03, 2013 15:13:56

Hi. To help out, I just grabbed one of the 'Hello World' PhoneGap apps I had. It's based on PhoneGap 2.7 and not that old but it doesn't have any of my code so it's easier to provide a sample than ripping all my code out of my newer app.

So, anyway, in the attached .zip file, there's the "www" folder of a basic PhoneGap app. You can load the www/index.html in a browser and see the error. (You can ignore the Cross-Origin Request errors that happen in the browser. They don't affect the loading of client.js and subsequent errors and that's typical of trying to run a PhoneGap app in the browser..

Anyway, an interesting change from the last failure is that, when I run this app in the iPad simulator, the onLoadCallback DOES get called. The failure in processing after client.js loaded.

The failures I see are those mentioned in comment #24: "Uncaught TypeError: Object [object Object] has no method 'hefn' " that seems to be encountered when the loading of client.js tries to call the onLoadCallback.

I've included the whole "Hello World" project but the key files are index.html (that loads client.js) and js/index.js (where you can change the false to true to try to load the APIs (but they fail because gapi.client isn't initialized due to the uncaught TypeError.

Note that you need to run index.html in a browser in "file" mode (like a local file not in the context of a web server) since that's how PhoneGap processes it.

Hope this helps.

Attachment: www.zip

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on August 03, 2013 15:18:08

And here are 3 JS files downloaded from my running this project in Chrome.

The error occurs in the clientjs-trying-to-load-callback.js file. And in the Inspector console both cb-gapi-loaded_0.js and cb-gapi-loaded_1.js were there (though I had to change the names of all these to save them sanely).

Attachment: cb-gapi-loaded_0.js cb-gapi-loaded_1.js clientjs-trying-to-load-callback.js

@wonderfly
Copy link
Contributor Author

From j...@google.com on August 03, 2013 21:40:25

We have identified the issue and are working on a solution.

(Thank you very much jarn..@. Your detailed description of the problem was a great help to us in tracking down the issue)

Status: Started

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on August 03, 2013 21:56:01

You're welcome! I hope you can get to the source of the old and new problems and keep things stable. I appreciate what the Google API Javascript Client offers to developers and look forward to regaining confidence in it as a tool on which I can build my products.

Looking forward to hearing that the problems of the last week or so are behind us.

@wonderfly
Copy link
Contributor Author

From yanisdan...@gmail.com on August 05, 2013 01:48:41

Good news ! I am looking forward to hear from you.

By the way, you can also find some information on this issue page which may help you : https://code.google.com/p/googleappengine/issues/detail?id=9747 "
Thomas created a brand new appengine app with a test endpoint and an android app.

The test simply load the API and call the unique GET ressource available.
He made an archive for you containing the appengine and android projects ( https://docs.google.com/file/d/0Bx2WmTu2GXx8SGRPMEREV2JaSVU/edit?usp=sharing ).
"

@wonderfly
Copy link
Contributor Author

From kes...@logistimo.com on August 05, 2013 02:08:16

I am facing the same issue. Things have stopped working since this morning. I am generating an apk file and on the device i see the following error message

Uncaught TypeError: Object # has no method 'hefn' at https://apis.google.com/js/client.js?onload=loadGapi:6

@wonderfly
Copy link
Contributor Author

From loomtro...@gmail.com on August 05, 2013 15:19:28

Any update on this? I'm getting Uncaught TypeError: Object [object Object] has no method 'hefn' still and I can't continue developing my app until it's fixed...

@wonderfly
Copy link
Contributor Author

From j...@google.com on August 05, 2013 16:48:45

We are aiming to have the fix pushed by EOD tomorrow. I will post an update once the push is out. It helps to know the scope of the issue so thank you all for speaking up!

@wonderfly
Copy link
Contributor Author

From YanisKia...@gmail.com on August 06, 2013 02:49:01

Great !
Our production applications have been down during 8 days on 12 days... Even if the impact of our turnover is huge, we are losing both money and customers.
Thank you for your support.

@wonderfly
Copy link
Contributor Author

From YanisKia...@gmail.com on August 07, 2013 00:51:17

It's working on our app.
We need to inform our customers, but not without to be sure of your fix.

Can you provide us a status on this issue ?

Can you insure us that you will test an phonegap app before pushing your code in production ?

@wonderfly
Copy link
Contributor Author

From jarnold...@gmail.com on August 07, 2013 06:33:33

Seems to be working again. It would be great if you could confirm that you found and corrected the root cause. We are, of course, especially interested in knowing that our use case is included in future pre-release testing so we have a little restored confidence that our choice of the Google API Javascript Client is a good choice in the future.

Thanks.

@wonderfly
Copy link
Contributor Author

From YanisKia...@gmail.com on August 07, 2013 10:30:21

Any news, any update ?

@wonderfly
Copy link
Contributor Author

From j...@google.com on August 07, 2013 10:56:27

Hi everyone,
Phonegap experienced difficulties with our library twice recently: the first breakage was reported to have happened on 7/26, the second on 8/3.
The fix for the 8/3-breakage was pushed around 2AM PST on 8/7.
We have identified the cause of the 7/26 breakage as well.

We will prioritize improving our test coverage across different platforms and use cases.
Thanks!

Status: Verified

@wonderfly
Copy link
Contributor Author

From YanisKia...@gmail.com on August 07, 2013 11:04:24

Nice to have good news from you !

Please do not afraid us again with such downtime of our app ! ;-)

Thank you and enjoy !

@wonderfly
Copy link
Contributor Author

From kes...@logistimo.com on August 07, 2013 19:16:29

Thank you very much. This was holding up our release.

@wonderfly
Copy link
Contributor Author

From shaikanj...@a-cti.com on April 08, 2014 03:25:57

I'm using: https://apis.google.com/js/client.js gapi.client.load('public', 'v2', function(){
gapi.client.public.organizations().execute(function(response){
console.log(response);
});
}, ' https://XXX.appspot.com/_ah/api'); For Today all the requests are responding with the following content
[{"error":{"code":404,"message":"Not Found","data":[{"domain":"global","reason":"notFound","message":"Not Found"}]},"id":"gapiRpc"}]

does anyone facing this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant